From 9cb67f6706484e2f60398aac0403fcbb3232cd90 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 3 Oct 2022 21:21:31 +0100 Subject: [PATCH] DEV: Bump rubocop-discourse (#207) * DEV: Bump rubocop-discourse * Fix rubocop violations --- Gemfile.lock | 31 ++++++++++--------- .../composer_messages_finder_spec.rb | 4 +-- spec/components/post_revisor_spec.rb | 2 +- spec/integration/solved_spec.rb | 2 +- ...t_accepted_post_solution_validator_spec.rb | 18 +++++------ spec/requests/topics_controller_spec.rb | 4 +-- 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0e83210..87ff84d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,31 +2,32 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.2) - parallel (1.20.1) - parser (3.0.1.0) + json (2.6.2) + parallel (1.22.1) + parser (3.1.2.1) ast (~> 2.4.1) - rainbow (3.0.0) - regexp_parser (2.1.1) + rainbow (3.1.1) + regexp_parser (2.6.0) rexml (3.2.5) - rubocop (1.13.0) + rubocop (1.36.0) + json (~> 2.3) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.2.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.20.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.4.1) - parser (>= 2.7.1.5) - rubocop-discourse (2.4.1) + 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.2.0) - rubocop (~> 1.0) - rubocop-ast (>= 1.1.0) + rubocop-rspec (2.13.2) + rubocop (~> 1.33) ruby-progressbar (1.11.0) - unicode-display_width (2.0.0) + unicode-display_width (2.3.0) PLATFORMS ruby diff --git a/spec/components/composer_messages_finder_spec.rb b/spec/components/composer_messages_finder_spec.rb index c7d310e..9f17b07 100644 --- a/spec/components/composer_messages_finder_spec.rb +++ b/spec/components/composer_messages_finder_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' require 'composer_messages_finder' describe ComposerMessagesFinder do - context '.check_topic_is_solved' do + describe '.check_topic_is_solved' do fab!(:user) { Fabricate(:user) } fab!(:topic) { Fabricate(:topic) } fab!(:post) { Fabricate(:post, topic: topic, user: Fabricate(:user)) } @@ -19,7 +19,7 @@ describe ComposerMessagesFinder do expect(described_class.new(user, composer_action: 'reply').check_topic_is_solved).to be_blank end - context "a reply" do + describe "a reply" do it "does not show message if topic is not solved" do expect(described_class.new(user, composer_action: 'reply', topic_id: topic.id).check_topic_is_solved).to be_blank end diff --git a/spec/components/post_revisor_spec.rb b/spec/components/post_revisor_spec.rb index d60a07c..e71588b 100644 --- a/spec/components/post_revisor_spec.rb +++ b/spec/components/post_revisor_spec.rb @@ -30,7 +30,7 @@ describe PostRevisor do expect(messages.first.data[:refresh_stream]).to eq(true) end - context 'Allowing solved via tags' do + describe 'Allowing solved via tags' do before do SiteSetting.solved_enabled = true SiteSetting.tagging_enabled = true diff --git a/spec/integration/solved_spec.rb b/spec/integration/solved_spec.rb index 4f8d68a..80c8696 100644 --- a/spec/integration/solved_spec.rb +++ b/spec/integration/solved_spec.rb @@ -176,7 +176,7 @@ RSpec.describe "Managing Posts solved status" do end end - context 'group moderators' do + context 'with group moderators' do fab!(:group_user) { Fabricate(:group_user) } let(:user_gm) { group_user.user } let(:group) { group_user.group } diff --git a/spec/lib/first_accepted_post_solution_validator_spec.rb b/spec/lib/first_accepted_post_solution_validator_spec.rb index 39d07b3..7a7be0b 100644 --- a/spec/lib/first_accepted_post_solution_validator_spec.rb +++ b/spec/lib/first_accepted_post_solution_validator_spec.rb @@ -5,15 +5,15 @@ require 'rails_helper' describe FirstAcceptedPostSolutionValidator do fab!(:user_tl1) { Fabricate(:user, trust_level: TrustLevel[1]) } - context 'user is under max trust level' do - context 'has no post accepted yet' do + context 'when user is under max trust level' do + context 'with no post accepted yet' do it 'validates the post' do post_1 = create_post(user: user_tl1) expect(described_class.check(post_1, trust_level: TrustLevel[2])).to eq(true) end end - context 'has already had accepted posts' do + context 'with already had accepted posts' do before do accepted_post = create_post(user: user_tl1) DiscourseSolved.accept_answer!(accepted_post, Discourse.system_user) @@ -26,15 +26,15 @@ describe FirstAcceptedPostSolutionValidator do end end - context 'user is above or equal max trust level' do - context 'has no post accepted yet' do + context 'when a user is above or equal max trust level' do + context 'with no post accepted yet' do it 'doesn’t validate the post' do post_1 = create_post(user: user_tl1) expect(described_class.check(post_1, trust_level: TrustLevel[1])).to eq(false) end end - context 'has already had accepted posts' do + context 'when a post is already accepted' do before do accepted_post = create_post(user: user_tl1) DiscourseSolved.accept_answer!(accepted_post, Discourse.system_user) @@ -47,21 +47,21 @@ describe FirstAcceptedPostSolutionValidator do end end - context 'using any trust level' do + context 'when using any trust level' do it 'validates the post' do post_1 = create_post(user: user_tl1) expect(described_class.check(post_1, trust_level: 'any')).to eq(true) end end - context 'user is system' do + context 'when user is system' do it 'doesn’t validate the post' do post_1 = create_post(user: Discourse.system_user) expect(described_class.check(post_1, trust_level: 'any')).to eq(false) end end - context 'post is a PM' do + context 'when post is a PM' do it 'doesn’t validate the post' do post_1 = create_post(user: user_tl1, target_usernames: [user_tl1.username], archetype: Archetype.private_message) expect(described_class.check(post_1, trust_level: 'any')).to eq(false) diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rb index b101014..c7c624f 100644 --- a/spec/requests/topics_controller_spec.rb +++ b/spec/requests/topics_controller_spec.rb @@ -31,7 +31,7 @@ RSpec.describe TopicsController do } end - context 'solved enabled on every topic' do + context 'with solved enabled on every topic' do before do SiteSetting.allow_solved_on_all_topics = true end @@ -63,7 +63,7 @@ RSpec.describe TopicsController do end end - context 'solved enabled for topics with specific tags' do + context 'with solved enabled for topics with specific tags' do let(:tag) { Fabricate(:tag) } before { SiteSetting.enable_solved_tags = tag.name }