Different message expectation methods for setup and assertion
I will generally use allow for setup:
before do
allow(foo).to receive(:bar).and_return(:baz)
end
and assertion:
it { expect(foo).to receive(:bar) }
If this makes sense, it could make a case for making MessageExpectation context aware. 🙂
Ah yeah we made that disabled by default because no one besides me wanted to say "only use expect(...).to have_received(...) exclusively". I think it was superseded by MessageSpies? Might fit your use case better but let me know because I sort of forget the little details of these cops over time.
btw excited to see you opening issues on rubocop-rspec too :smile:
I will play around a bit with the settings, and see if I can get something that fits. If not, at least I can make a more specific suggestion. 🙂
btw excited to see you opening issues on rubocop-rspec too 😄
Yes. I'm spilling over into the neighbouring communities. 😅