spec/rubocop/cop/rspec/subject_stub_spec.rb in rubocop-rspec-1.19.0 vs spec/rubocop/cop/rspec/subject_stub_spec.rb in rubocop-rspec-1.20.0
- old
+ new
@@ -57,9 +57,20 @@
end
end
RUBY
end
+ it 'ignores stub when inside all matcher' do
+ expect_no_offenses(<<-RUBY)
+ describe Foo do
+ subject(:foo) { [Object.new] }
+ it 'tries to trick rubocop-rspec' do
+ expect(foo).to all(receive(:baz))
+ end
+ end
+ RUBY
+ end
+
it 'flags nested subject stubs when nested subject uses same name' do
expect_offense(<<-RUBY)
describe Foo do
subject(:foo) { described_class.new }