rubocop-rspec
rubocop-rspec copied to clipboard
Cop idea: detect calling of a mock inside the example
I know this is weird, but I've seen code such as
expect(Foo).to receive(:bar).and_return(:baz)
expect(subject.baz).to eq Foo.bar
(one very interesting example was expect(Account).to receive(:all).once.and_return(Account.all)
)
Such strange misuses of mocks could be detected by rubocop-rspec
Related to #221, (will supposedly be) fixed in #226.