spec/rubocop/cop/rspec/subject_stub_spec.rb in rubocop-rspec-1.15.1 vs spec/rubocop/cop/rspec/subject_stub_spec.rb in rubocop-rspec-1.16.0

- old
+ new

@@ -2,11 +2,11 @@ RSpec.describe RuboCop::Cop::RSpec::SubjectStub do subject(:cop) { described_class.new } it 'complains when subject is stubbed' do - expect_violation(<<-RUBY) + expect_offense(<<-RUBY) describe Foo do subject(:foo) { described_class.new } before do allow(foo).to receive(:bar).and_return(baz) @@ -19,11 +19,11 @@ end RUBY end it 'complains when subject is mocked' do - expect_violation(<<-RUBY) + expect_offense(<<-RUBY) describe Foo do subject(:foo) { described_class.new } before do expect(foo).to receive(:bar).and_return(baz) @@ -42,11 +42,11 @@ end RUBY end it 'ignores stub within context where subject name changed' do - expect_no_violations(<<-RUBY) + expect_no_offenses(<<-RUBY) describe Foo do subject(:foo) { described_class.new } context 'when I shake things up' do subject(:bar) { described_class.new } @@ -58,11 +58,11 @@ end RUBY end it 'flags nested subject stubs when nested subject uses same name' do - expect_violation(<<-RUBY) + expect_offense(<<-RUBY) describe Foo do subject(:foo) { described_class.new } context 'when I shake things up' do subject(:foo) { described_class.new } @@ -79,11 +79,11 @@ end RUBY end it 'ignores nested stubs when nested subject is anonymous' do - expect_no_violations(<<-RUBY) + expect_no_offenses(<<-RUBY) describe Foo do subject(:foo) { described_class.new } context 'when I shake things up' do subject { described_class.new } @@ -99,11 +99,11 @@ end RUBY end it 'flags nested subject stubs when example group does not define subject' do - expect_violation(<<-RUBY) + expect_offense(<<-RUBY) describe Foo do subject(:foo) { described_class.new } context 'when I shake things up' do before do @@ -118,11 +118,11 @@ end RUBY end it 'flags nested subject stubs' do - expect_violation(<<-RUBY) + expect_offense(<<-RUBY) describe Foo do subject(:foo) { described_class.new } context 'when I shake things up' do subject(:bar) { described_class.new } @@ -140,11 +140,11 @@ end RUBY end it 'flags nested subject stubs when adjacent context redefines' do - expect_violation(<<-RUBY) + expect_offense(<<-RUBY) describe Foo do subject(:foo) { described_class.new } context 'when I do something in a context' do subject { blah } @@ -157,10 +157,10 @@ end RUBY end it 'flags deeply nested subject stubs' do - expect_violation(<<-RUBY) + expect_offense(<<-RUBY) describe Foo do subject(:foo) { described_class.new } context 'level 1' do subject(:bar) { described_class.new }