[Rspec-users] overriding mock expectations
Micah Martin
micah at 8thlight.com
Mon Oct 23 18:34:00 EDT 2006
There is one annoyance I'm encountering with the Mock API in rSpec.
Overall it works well, as far as dynamic mocks go ;)... but there's
this one thing... It doesn't allow overriding of expectations.
example:
m = mock("blah")
m.should_receive(:one).any_number_of_times().and_return(1)
m.should_receive(:one).and_return(1)
The second call to should_receive is ignored. I believe it would be
most convenient if the second call to should_receive would override
the first.
Why?
What I would like to do is define all the should_receives once in the
setup using any_number_of_times. This establishes a default
context. Then in each spec I'd like to override a specific
should_receive relevant to the spec.
Without being able to override, I am force to define all the
should_receives for each spec..... duplication.
Is there another solution I'm missing?
Micah Martin
8th Light, Inc.
www.8thlight.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20061023/24f10a56/attachment.html
More information about the Rspec-users
mailing list