diff options
author | Vitali Tatarintev <vtatarintev@gitlab.com> | 2019-08-26 10:04:54 +0200 |
---|---|---|
committer | Vitali Tatarintev <vtatarintev@gitlab.com> | 2019-08-28 08:43:47 +0200 |
commit | 99b27e69510e83006d4dd2e5ecc5c555409aa4a0 (patch) | |
tree | 80087416d0f94904e22f63bfbb39e6742b443b39 /spec/rubocop | |
parent | b61d26f496a2041d7124fd3280031deda3cf5a43 (diff) | |
download | gitlab-ce-99b27e69510e83006d4dd2e5ecc5c555409aa4a0.tar.gz |
Utilize Rubocop's Include for BeSuccessMatcher
Use Rubocop's Include
instead of manually checking the matcher in controllers specs.
Diffstat (limited to 'spec/rubocop')
-rw-r--r-- | spec/rubocop/cop/rspec/be_success_matcher_spec.rb | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/spec/rubocop/cop/rspec/be_success_matcher_spec.rb b/spec/rubocop/cop/rspec/be_success_matcher_spec.rb index 95f08a61557..77aff7c9dcc 100644 --- a/spec/rubocop/cop/rspec/be_success_matcher_spec.rb +++ b/spec/rubocop/cop/rspec/be_success_matcher_spec.rb @@ -59,35 +59,17 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do end end - context 'in a controller spec file' do - before do - allow(cop).to receive(:in_controller_spec?).and_return(true) + CODE_EXAMPLES.each do |code_example| + context "using #{code_example[:bad]} call" do + it_behaves_like 'an offensive be_success call', code_example[:bad] + it_behaves_like 'an autocorrected be_success call', code_example[:bad], code_example[:good] end - CODE_EXAMPLES.each do |code_example| - context "using #{code_example[:bad]} call" do - it_behaves_like 'an offensive be_success call', code_example[:bad] - it_behaves_like 'an autocorrected be_success call', code_example[:bad], code_example[:good] - end - - context "using #{code_example[:good]} call" do - it 'does not register an offense' do - inspect_source(code_example[:good]) - - expect(cop.offenses.size).to eq(0) - end - end - end - end - - context 'outside of a controller spec file' do - CODE_EXAMPLES.each do |code_example| - context "using #{code_example[:bad]} call" do - it 'does not register an offense' do - inspect_source(code_example[:bad]) + context "using #{code_example[:good]} call" do + it 'does not register an offense' do + inspect_source(code_example[:good]) - expect(cop.offenses.size).to eq(0) - end + expect(cop.offenses.size).to eq(0) end end end |