Skip to content

Commit

Permalink
Auto-correct RuboCop offenses for RSpec/ItBehavesLike
Browse files Browse the repository at this point in the history
  • Loading branch information
Dany Marcoux committed Jun 10, 2020
1 parent 908124b commit d61642d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 57 deletions.
13 changes: 0 additions & 13 deletions src/api/.rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -752,19 +752,6 @@ RSpec/InstanceVariable:
- 'spec/models/relationship_spec.rb'
- 'spec/models/review_spec.rb'

# Offense count: 54
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: it_behaves_like, it_should_behave_like
RSpec/ItBehavesLike:
Exclude:
- 'spec/helpers/webui/package_helper_spec.rb'
- 'spec/models/bs_request_action_spec.rb'
- 'spec/models/bs_request_spec.rb'
- 'spec/models/project_status/pack_info_spec.rb'
- 'spec/models/review_spec.rb'
- 'spec/models/user_ldap_strategy_spec.rb'

# Offense count: 1
RSpec/IteratedExpectation:
Exclude:
Expand Down
40 changes: 20 additions & 20 deletions src/api/spec/helpers/webui/package_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@
end
end

it_should_behave_like 'file with extension', 'group', 'xml'
it_should_behave_like 'file with extension', 'kiwi', 'xml'
it_should_behave_like 'file with extension', 'product', 'xml'
it_should_behave_like 'file with extension', 'xml', 'xml'
it_behaves_like 'file with extension', 'group', 'xml'
it_behaves_like 'file with extension', 'kiwi', 'xml'
it_behaves_like 'file with extension', 'product', 'xml'
it_behaves_like 'file with extension', 'xml', 'xml'
end

context 'is shell' do
Expand Down Expand Up @@ -178,51 +178,51 @@
end

context 'is diff' do
it_should_behave_like 'file with extension', 'patch', 'diff'
it_should_behave_like 'file with extension', 'dif', 'diff'
it_should_behave_like 'file with extension', 'diff', 'diff'
it_behaves_like 'file with extension', 'patch', 'diff'
it_behaves_like 'file with extension', 'dif', 'diff'
it_behaves_like 'file with extension', 'diff', 'diff'
end

context 'is perl' do
it_should_behave_like 'file with extension', 'pl', 'perl'
it_should_behave_like 'file with extension', 'pm', 'perl'
it_should_behave_like 'file with extension', 'perl', 'perl'
it_behaves_like 'file with extension', 'pl', 'perl'
it_behaves_like 'file with extension', 'pm', 'perl'
it_behaves_like 'file with extension', 'perl', 'perl'
end

context 'is python' do
it_should_behave_like 'file with extension', 'py', 'python'
it_behaves_like 'file with extension', 'py', 'python'
end

context 'is ruby' do
it_should_behave_like 'file with extension', 'rb', 'ruby'
it_behaves_like 'file with extension', 'rb', 'ruby'
end

context 'is latex' do
it_should_behave_like 'file with extension', 'tex', 'latex'
it_behaves_like 'file with extension', 'tex', 'latex'
end

context 'is javascript' do
it_should_behave_like 'file with extension', 'js', 'javascript'
it_behaves_like 'file with extension', 'js', 'javascript'
end

context 'is shell' do
it_should_behave_like 'file with extension', 'sh', 'shell'
it_behaves_like 'file with extension', 'sh', 'shell'
end

context 'is rpm-spec' do
it_should_behave_like 'file with extension', 'spec', 'rpm-spec'
it_behaves_like 'file with extension', 'spec', 'rpm-spec'
end

context 'is rpm-changes' do
it_should_behave_like 'file with extension', 'changes', 'rpm-changes'
it_behaves_like 'file with extension', 'changes', 'rpm-changes'
end

context 'is php' do
it_should_behave_like 'file with extension', 'php', 'php'
it_behaves_like 'file with extension', 'php', 'php'
end

context 'is html' do
it_should_behave_like 'file with extension', 'html', 'html'
it_behaves_like 'file with extension', 'html', 'html'
end

context 'is dockerfile' do
Expand All @@ -239,7 +239,7 @@
end

context 'css' do
it_should_behave_like 'file with extension', 'css', 'css'
it_behaves_like 'file with extension', 'css', 'css'
end

context 'other' do
Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/models/bs_request_action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
end
end

it_should_behave_like 'it skips validation for type', 'add_role'
it_should_behave_like 'it skips validation for type', 'maintenance_incident'
it_behaves_like 'it skips validation for type', 'add_role'
it_behaves_like 'it skips validation for type', 'maintenance_incident'
end

it { is_expected.to belong_to(:bs_request).touch(true) }
Expand Down
14 changes: 7 additions & 7 deletions src/api/spec/models/bs_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
let!(:request) { create(:set_bugowner_request, creator: user) }
let(:user) { create(:admin_user) }

it_should_behave_like "the subject's cache is reset when it's request changes"
it_behaves_like "the subject's cache is reset when it's request changes"
end

context 'direct maintainer of a target_project' do
Expand All @@ -324,7 +324,7 @@
let!(:relationship_project_user) { create(:relationship_project_user, project: target_project) }
let(:user) { relationship_project_user.user }

it_should_behave_like "the subject's cache is reset when it's request changes"
it_behaves_like "the subject's cache is reset when it's request changes"
end

context 'group maintainer of a target_project' do
Expand All @@ -341,10 +341,10 @@
let!(:groups_user) { create(:groups_user, group: group) }
let(:user) { groups_user.user }

it_should_behave_like "the subject's cache is reset when it's request changes" do
it_behaves_like "the subject's cache is reset when it's request changes" do
subject { user }
end
it_should_behave_like "the subject's cache is reset when it's request changes" do
it_behaves_like "the subject's cache is reset when it's request changes" do
subject { group }
end
end
Expand All @@ -354,7 +354,7 @@
let!(:relationship_package_user) { create(:relationship_package_user, package: target_package) }
let(:user) { relationship_package_user.user }

it_should_behave_like "the subject's cache is reset when it's request changes"
it_behaves_like "the subject's cache is reset when it's request changes"
end

context 'group maintainer of a target_package' do
Expand All @@ -364,10 +364,10 @@
let!(:groups_user) { create(:groups_user, group: group) }
let(:user) { groups_user.user }

it_should_behave_like "the subject's cache is reset when it's request changes" do
it_behaves_like "the subject's cache is reset when it's request changes" do
subject { user }
end
it_should_behave_like "the subject's cache is reset when it's request changes" do
it_behaves_like "the subject's cache is reset when it's request changes" do
subject { group }
end
end
Expand Down
6 changes: 3 additions & 3 deletions src/api/spec/models/project_status/pack_info_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
pack_info.set_versrel('2.0-43', two_hours_ago)
end

it_should_behave_like 'a PackInfo object'
it_behaves_like 'a PackInfo object'
end

context 'with newer version time' do
Expand All @@ -42,7 +42,7 @@
pack_info.set_versrel("#{version}-#{release}", time)
end

it_should_behave_like 'a PackInfo object'
it_behaves_like 'a PackInfo object'
end

context 'with long version' do
Expand All @@ -52,7 +52,7 @@
pack_info.set_versrel("#{version}-#{release}", time)
end

it_should_behave_like 'a PackInfo object'
it_behaves_like 'a PackInfo object'
end
end
end
Expand Down
18 changes: 9 additions & 9 deletions src/api/spec/models/review_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
let!(:review) { create(:user_review) }
subject { review.user }

it_should_behave_like "the subject's cache is reset when it's review changes"
it_behaves_like "the subject's cache is reset when it's review changes"
end

context 'by_group' do
Expand All @@ -367,10 +367,10 @@
let(:user) { groups_user.user }
let!(:review) { create(:review, by_group: group) }

it_should_behave_like "the subject's cache is reset when it's review changes" do
it_behaves_like "the subject's cache is reset when it's review changes" do
subject { user }
end
it_should_behave_like "the subject's cache is reset when it's review changes" do
it_behaves_like "the subject's cache is reset when it's review changes" do
subject { group }
end
end
Expand All @@ -381,7 +381,7 @@
let!(:review) { create(:review, by_package: package, by_project: package.project) }
subject { relationship_package_user.user }

it_should_behave_like "the subject's cache is reset when it's review changes"
it_behaves_like "the subject's cache is reset when it's review changes"
end

context 'by_package with a group relationship' do
Expand All @@ -392,10 +392,10 @@
let!(:user) { groups_user.user }
let!(:review) { create(:review, by_package: package, by_project: package.project) }

it_should_behave_like "the subject's cache is reset when it's review changes" do
it_behaves_like "the subject's cache is reset when it's review changes" do
subject { user }
end
it_should_behave_like "the subject's cache is reset when it's review changes" do
it_behaves_like "the subject's cache is reset when it's review changes" do
subject { group }
end
end
Expand All @@ -406,7 +406,7 @@
let!(:review) { create(:review, by_project: project) }
subject { relationship_project_user.user }

it_should_behave_like "the subject's cache is reset when it's review changes"
it_behaves_like "the subject's cache is reset when it's review changes"
end

context 'by_project with a group relationship' do
Expand All @@ -417,10 +417,10 @@
let!(:user) { groups_user.user }
let!(:review) { create(:review, by_project: project) }

it_should_behave_like "the subject's cache is reset when it's review changes" do
it_behaves_like "the subject's cache is reset when it's review changes" do
subject { user }
end
it_should_behave_like "the subject's cache is reset when it's review changes" do
it_behaves_like "the subject's cache is reset when it's review changes" do
subject { group }
end
end
Expand Down
6 changes: 3 additions & 3 deletions src/api/spec/models/user_ldap_strategy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
stub_const('CONFIG', CONFIG.merge('ldap_ssl' => :on))
end

it_should_behave_like 'a ldap connection'
it_behaves_like 'a ldap connection'
end

context 'configured for TSL' do
Expand All @@ -109,7 +109,7 @@
stub_const('CONFIG', CONFIG.merge('ldap_start_tls' => :on))
end

it_should_behave_like 'a ldap connection'
it_behaves_like 'a ldap connection'
end

context 'not configured for TSL or SSL' do
Expand All @@ -119,7 +119,7 @@
stub_const('CONFIG', CONFIG.merge('ldap_ssl' => :off))
end

it_should_behave_like 'a ldap connection'
it_behaves_like 'a ldap connection'
end
end
end
Expand Down

0 comments on commit d61642d

Please sign in to comment.