DEV: Bump rubocop-discourse (#207)
* DEV: Bump rubocop-discourse * Fix rubocop violations
This commit is contained in:
parent
e96934d60f
commit
9cb67f6706
31
Gemfile.lock
31
Gemfile.lock
|
@ -2,31 +2,32 @@ GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
ast (2.4.2)
|
ast (2.4.2)
|
||||||
parallel (1.20.1)
|
json (2.6.2)
|
||||||
parser (3.0.1.0)
|
parallel (1.22.1)
|
||||||
|
parser (3.1.2.1)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
rainbow (3.0.0)
|
rainbow (3.1.1)
|
||||||
regexp_parser (2.1.1)
|
regexp_parser (2.6.0)
|
||||||
rexml (3.2.5)
|
rexml (3.2.5)
|
||||||
rubocop (1.13.0)
|
rubocop (1.36.0)
|
||||||
|
json (~> 2.3)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 3.0.0.0)
|
parser (>= 3.1.2.1)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
regexp_parser (>= 1.8, < 3.0)
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
rexml
|
rexml (>= 3.2.5, < 4.0)
|
||||||
rubocop-ast (>= 1.2.0, < 2.0)
|
rubocop-ast (>= 1.20.1, < 2.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 3.0)
|
unicode-display_width (>= 1.4.0, < 3.0)
|
||||||
rubocop-ast (1.4.1)
|
rubocop-ast (1.21.0)
|
||||||
parser (>= 2.7.1.5)
|
parser (>= 3.1.1.0)
|
||||||
rubocop-discourse (2.4.1)
|
rubocop-discourse (3.0)
|
||||||
rubocop (>= 1.1.0)
|
rubocop (>= 1.1.0)
|
||||||
rubocop-rspec (>= 2.0.0)
|
rubocop-rspec (>= 2.0.0)
|
||||||
rubocop-rspec (2.2.0)
|
rubocop-rspec (2.13.2)
|
||||||
rubocop (~> 1.0)
|
rubocop (~> 1.33)
|
||||||
rubocop-ast (>= 1.1.0)
|
|
||||||
ruby-progressbar (1.11.0)
|
ruby-progressbar (1.11.0)
|
||||||
unicode-display_width (2.0.0)
|
unicode-display_width (2.3.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
||||||
require 'composer_messages_finder'
|
require 'composer_messages_finder'
|
||||||
|
|
||||||
describe ComposerMessagesFinder do
|
describe ComposerMessagesFinder do
|
||||||
context '.check_topic_is_solved' do
|
describe '.check_topic_is_solved' do
|
||||||
fab!(:user) { Fabricate(:user) }
|
fab!(:user) { Fabricate(:user) }
|
||||||
fab!(:topic) { Fabricate(:topic) }
|
fab!(:topic) { Fabricate(:topic) }
|
||||||
fab!(:post) { Fabricate(:post, topic: topic, user: Fabricate(:user)) }
|
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
|
expect(described_class.new(user, composer_action: 'reply').check_topic_is_solved).to be_blank
|
||||||
end
|
end
|
||||||
|
|
||||||
context "a reply" do
|
describe "a reply" do
|
||||||
it "does not show message if topic is not solved" 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
|
expect(described_class.new(user, composer_action: 'reply', topic_id: topic.id).check_topic_is_solved).to be_blank
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe PostRevisor do
|
||||||
expect(messages.first.data[:refresh_stream]).to eq(true)
|
expect(messages.first.data[:refresh_stream]).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Allowing solved via tags' do
|
describe 'Allowing solved via tags' do
|
||||||
before do
|
before do
|
||||||
SiteSetting.solved_enabled = true
|
SiteSetting.solved_enabled = true
|
||||||
SiteSetting.tagging_enabled = true
|
SiteSetting.tagging_enabled = true
|
||||||
|
|
|
@ -176,7 +176,7 @@ RSpec.describe "Managing Posts solved status" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'group moderators' do
|
context 'with group moderators' do
|
||||||
fab!(:group_user) { Fabricate(:group_user) }
|
fab!(:group_user) { Fabricate(:group_user) }
|
||||||
let(:user_gm) { group_user.user }
|
let(:user_gm) { group_user.user }
|
||||||
let(:group) { group_user.group }
|
let(:group) { group_user.group }
|
||||||
|
|
|
@ -5,15 +5,15 @@ require 'rails_helper'
|
||||||
describe FirstAcceptedPostSolutionValidator do
|
describe FirstAcceptedPostSolutionValidator do
|
||||||
fab!(:user_tl1) { Fabricate(:user, trust_level: TrustLevel[1]) }
|
fab!(:user_tl1) { Fabricate(:user, trust_level: TrustLevel[1]) }
|
||||||
|
|
||||||
context 'user is under max trust level' do
|
context 'when user is under max trust level' do
|
||||||
context 'has no post accepted yet' do
|
context 'with no post accepted yet' do
|
||||||
it 'validates the post' do
|
it 'validates the post' do
|
||||||
post_1 = create_post(user: user_tl1)
|
post_1 = create_post(user: user_tl1)
|
||||||
expect(described_class.check(post_1, trust_level: TrustLevel[2])).to eq(true)
|
expect(described_class.check(post_1, trust_level: TrustLevel[2])).to eq(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'has already had accepted posts' do
|
context 'with already had accepted posts' do
|
||||||
before do
|
before do
|
||||||
accepted_post = create_post(user: user_tl1)
|
accepted_post = create_post(user: user_tl1)
|
||||||
DiscourseSolved.accept_answer!(accepted_post, Discourse.system_user)
|
DiscourseSolved.accept_answer!(accepted_post, Discourse.system_user)
|
||||||
|
@ -26,15 +26,15 @@ describe FirstAcceptedPostSolutionValidator do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'user is above or equal max trust level' do
|
context 'when a user is above or equal max trust level' do
|
||||||
context 'has no post accepted yet' do
|
context 'with no post accepted yet' do
|
||||||
it 'doesn’t validate the post' do
|
it 'doesn’t validate the post' do
|
||||||
post_1 = create_post(user: user_tl1)
|
post_1 = create_post(user: user_tl1)
|
||||||
expect(described_class.check(post_1, trust_level: TrustLevel[1])).to eq(false)
|
expect(described_class.check(post_1, trust_level: TrustLevel[1])).to eq(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'has already had accepted posts' do
|
context 'when a post is already accepted' do
|
||||||
before do
|
before do
|
||||||
accepted_post = create_post(user: user_tl1)
|
accepted_post = create_post(user: user_tl1)
|
||||||
DiscourseSolved.accept_answer!(accepted_post, Discourse.system_user)
|
DiscourseSolved.accept_answer!(accepted_post, Discourse.system_user)
|
||||||
|
@ -47,21 +47,21 @@ describe FirstAcceptedPostSolutionValidator do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'using any trust level' do
|
context 'when using any trust level' do
|
||||||
it 'validates the post' do
|
it 'validates the post' do
|
||||||
post_1 = create_post(user: user_tl1)
|
post_1 = create_post(user: user_tl1)
|
||||||
expect(described_class.check(post_1, trust_level: 'any')).to eq(true)
|
expect(described_class.check(post_1, trust_level: 'any')).to eq(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'user is system' do
|
context 'when user is system' do
|
||||||
it 'doesn’t validate the post' do
|
it 'doesn’t validate the post' do
|
||||||
post_1 = create_post(user: Discourse.system_user)
|
post_1 = create_post(user: Discourse.system_user)
|
||||||
expect(described_class.check(post_1, trust_level: 'any')).to eq(false)
|
expect(described_class.check(post_1, trust_level: 'any')).to eq(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'post is a PM' do
|
context 'when post is a PM' do
|
||||||
it 'doesn’t validate the post' do
|
it 'doesn’t validate the post' do
|
||||||
post_1 = create_post(user: user_tl1, target_usernames: [user_tl1.username], archetype: Archetype.private_message)
|
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)
|
expect(described_class.check(post_1, trust_level: 'any')).to eq(false)
|
||||||
|
|
|
@ -31,7 +31,7 @@ RSpec.describe TopicsController do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'solved enabled on every topic' do
|
context 'with solved enabled on every topic' do
|
||||||
before do
|
before do
|
||||||
SiteSetting.allow_solved_on_all_topics = true
|
SiteSetting.allow_solved_on_all_topics = true
|
||||||
end
|
end
|
||||||
|
@ -63,7 +63,7 @@ RSpec.describe TopicsController do
|
||||||
end
|
end
|
||||||
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) }
|
let(:tag) { Fabricate(:tag) }
|
||||||
|
|
||||||
before { SiteSetting.enable_solved_tags = tag.name }
|
before { SiteSetting.enable_solved_tags = tag.name }
|
||||||
|
|
Loading…
Reference in New Issue