Is there a less intrusive alternative to Rspec’s `should_receive`?

It looks like the nicer API to delegate to the original method that Myron Marston alluded to has actually been added in rspec-mocks v2.12.0

  • Add and_call_original which delegates to the original method.

So now you can simply do this any time you “want to set a message expecation without interfering with how the object responds to the message”:

@baker.should_receive(:make_batter).and_call_original

Thanks for adding this, Myron.

Leave a Comment