rubocop-rspec icon indicating copy to clipboard operation
rubocop-rspec copied to clipboard

Cop idea: detect calling of a mock inside the example

Open Darhazer opened this issue 7 years ago • 1 comments

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

Darhazer avatar Jun 03 '17 16:06 Darhazer

Related to #221, (will supposedly be) fixed in #226.

pirj avatar Aug 20 '19 12:08 pirj