To only stub a method call if a given argument is used, but use the default implementation for other arguments:
object.should_receive(:some_method).and_call_original
object.should_receive(:some_method).with('my argument').and_return('other value')
Requires rspec-mocks
2.13+.
Posted by Henning Koch to makandra dev (2015-01-29 09:38)