From 5047583d9557bbbc8b651fc7eb1dee5e9ca5b4ce Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 3 Oct 2022 20:36:52 +0100 Subject: [PATCH] DEV: Bump rubocop-discourse (#141) * DEV: Bump rubocop-discourse * Fix rubocop violations --- Gemfile.lock | 41 +++++++++++-------- spec/dummy_provider.rb | 4 +- spec/helpers/helper_spec.rb | 2 +- .../mattermost_command_controller_spec.rb | 2 +- .../slack/slack_command_controller_spec.rb | 2 +- .../slack/slack_message_formatter_spec.rb | 2 +- .../telegram_command_controller_spec.rb | 2 +- spec/models/channel_spec.rb | 4 +- spec/models/rule_spec.rb | 2 +- spec/requests/chat_controller_spec.rb | 4 +- spec/services/manager_spec.rb | 2 +- 11 files changed, 36 insertions(+), 31 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a6c901f..8766725 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,28 +7,33 @@ GIT GEM remote: https://rubygems.org/ specs: - ast (2.4.0) - jaro_winkler (1.5.4) - parallel (1.19.1) - parser (2.7.1.2) - ast (~> 2.4.0) - rainbow (3.0.0) + ast (2.4.2) + json (2.6.2) + parallel (1.22.1) + parser (3.1.2.1) + ast (~> 2.4.1) + rainbow (3.1.1) + regexp_parser (2.6.0) rexml (3.2.5) - rubocop (0.82.0) - jaro_winkler (~> 1.5.1) + rubocop (1.36.0) + json (~> 2.3) parallel (~> 1.10) - parser (>= 2.7.0.1) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) - rexml + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.20.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-discourse (2.1.1) - rubocop (>= 0.69.0) - rubocop-rspec (>= 1.39.0) - rubocop-rspec (1.39.0) - rubocop (>= 0.68.1) - ruby-progressbar (1.10.1) - unicode-display_width (1.7.0) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.21.0) + parser (>= 3.1.1.0) + rubocop-discourse (3.0) + rubocop (>= 1.1.0) + rubocop-rspec (>= 2.0.0) + rubocop-rspec (2.13.2) + rubocop (~> 1.33) + ruby-progressbar (1.11.0) + unicode-display_width (2.3.0) PLATFORMS ruby diff --git a/spec/dummy_provider.rb b/spec/dummy_provider.rb index fdb6442..e9cd18e 100644 --- a/spec/dummy_provider.rb +++ b/spec/dummy_provider.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.shared_context "dummy provider" do +RSpec.shared_context "with dummy provider" do before(:each) do module ::DiscourseChatIntegration::Provider::DummyProvider PROVIDER_NAME = "dummy".freeze @@ -39,7 +39,7 @@ RSpec.shared_context "dummy provider" do let(:provider) { ::DiscourseChatIntegration::Provider::DummyProvider } end -RSpec.shared_context "validated dummy provider" do +RSpec.shared_context "with validated dummy provider" do before(:each) do module ::DiscourseChatIntegration::Provider::Dummy2Provider PROVIDER_NAME = "dummy2".freeze diff --git a/spec/helpers/helper_spec.rb b/spec/helpers/helper_spec.rb index e3709e1..e830dd7 100644 --- a/spec/helpers/helper_spec.rb +++ b/spec/helpers/helper_spec.rb @@ -4,7 +4,7 @@ require 'rails_helper' require_relative '../dummy_provider' RSpec.describe DiscourseChatIntegration::Manager do - include_context "dummy provider" + include_context "with dummy provider" let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') } let(:chan2) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') } diff --git a/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller_spec.rb b/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller_spec.rb index 8275dce..06402fc 100644 --- a/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller_spec.rb +++ b/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller_spec.rb @@ -95,7 +95,7 @@ describe 'Mattermost Command Controller', type: :request do expect(rule.tags).to eq(nil) end - context 'from an unknown channel' do + describe 'from an unknown channel' do it 'creates the channel' do post "/chat-integration/mattermost/command.json", params: { text: "watch #{category.slug}", diff --git a/spec/lib/discourse_chat_integration/provider/slack/slack_command_controller_spec.rb b/spec/lib/discourse_chat_integration/provider/slack/slack_command_controller_spec.rb index 15be5c2..4bfa178 100644 --- a/spec/lib/discourse_chat_integration/provider/slack/slack_command_controller_spec.rb +++ b/spec/lib/discourse_chat_integration/provider/slack/slack_command_controller_spec.rb @@ -113,7 +113,7 @@ describe 'Slack Command Controller', type: :request do expect(rule.tags).to eq(nil) end - context 'from an unknown channel' do + describe 'from an unknown channel' do it 'creates the channel' do post "/chat-integration/slack/command.json", params: { text: "watch #{category.slug}", diff --git a/spec/lib/discourse_chat_integration/provider/slack/slack_message_formatter_spec.rb b/spec/lib/discourse_chat_integration/provider/slack/slack_message_formatter_spec.rb index 374dd06..9404400 100644 --- a/spec/lib/discourse_chat_integration/provider/slack/slack_message_formatter_spec.rb +++ b/spec/lib/discourse_chat_integration/provider/slack/slack_message_formatter_spec.rb @@ -4,7 +4,7 @@ require 'rails_helper' RSpec.describe DiscourseChatIntegration::Provider::SlackProvider::SlackMessageFormatter do describe '.format' do - context 'links' do + context 'with links' do it 'should return the right message' do expect(described_class.format("test")) .to eq('') diff --git a/spec/lib/discourse_chat_integration/provider/telegram/telegram_command_controller_spec.rb b/spec/lib/discourse_chat_integration/provider/telegram/telegram_command_controller_spec.rb index fe0cbfb..33288eb 100644 --- a/spec/lib/discourse_chat_integration/provider/telegram/telegram_command_controller_spec.rb +++ b/spec/lib/discourse_chat_integration/provider/telegram/telegram_command_controller_spec.rb @@ -108,7 +108,7 @@ describe 'Telegram Command Controller', type: :request do expect(rule.tags).to eq(nil) end - context 'from an unknown channel' do + describe 'from an unknown channel' do it 'does nothing' do post '/chat-integration/telegram/command/shhh.json', params: { message: { chat: { id: 456 }, text: "/watch #{category.slug}" } diff --git a/spec/models/channel_spec.rb b/spec/models/channel_spec.rb index 2092b0a..b636ff4 100644 --- a/spec/models/channel_spec.rb +++ b/spec/models/channel_spec.rb @@ -4,8 +4,8 @@ require 'rails_helper' require_relative '../dummy_provider' RSpec.describe DiscourseChatIntegration::Channel do - include_context "dummy provider" - include_context "validated dummy provider" + include_context "with dummy provider" + include_context "with validated dummy provider" it 'should save and load successfully' do expect(DiscourseChatIntegration::Channel.all.length).to eq(0) diff --git a/spec/models/rule_spec.rb b/spec/models/rule_spec.rb index bd4833b..45e97f2 100644 --- a/spec/models/rule_spec.rb +++ b/spec/models/rule_spec.rb @@ -4,7 +4,7 @@ require 'rails_helper' require_relative '../dummy_provider' RSpec.describe DiscourseChatIntegration::Rule do - include_context "dummy provider" + include_context "with dummy provider" let(:tag1) { Fabricate(:tag) } let(:tag2) { Fabricate(:tag) } diff --git a/spec/requests/chat_controller_spec.rb b/spec/requests/chat_controller_spec.rb index f90f1eb..90960f5 100644 --- a/spec/requests/chat_controller_spec.rb +++ b/spec/requests/chat_controller_spec.rb @@ -12,8 +12,8 @@ describe 'Chat Controller', type: :request do let(:tag) { Fabricate(:tag) } let(:channel) { DiscourseChatIntegration::Channel.create(provider: 'dummy') } - include_context "dummy provider" - include_context "validated dummy provider" + include_context "with dummy provider" + include_context "with validated dummy provider" before do SiteSetting.chat_integration_enabled = true diff --git a/spec/services/manager_spec.rb b/spec/services/manager_spec.rb index 1d973f7..81885ad 100644 --- a/spec/services/manager_spec.rb +++ b/spec/services/manager_spec.rb @@ -15,7 +15,7 @@ RSpec.describe DiscourseChatIntegration::Manager do let(:second_post) { Fabricate(:post, topic: topic, post_number: 2) } describe '.trigger_notifications' do - include_context "dummy provider" + include_context "with dummy provider" let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') } let(:chan2) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') }