diff options
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 |