[rspec-users] Rspec
David Chelimsky
dchelimsky at gmail.com
Mon Jun 28 14:50:11 EDT 2010
On Jun 28, 2010, at 1:31 PM, Curtis j Schofield wrote:
> Hi - I extracted some methods in a refactor and put them into a nice
> module and i'm in the process of making sure it is covered as a
> first-class unit.
>
> I'm getting some strange behavior with what seems really straight forward code.
>
> https://gist.github.com/6d54448d70b07a126c51
should_receive replaces the method in question, so when you say:
@foo.should_receive(:toad_string)
the actual toad_string method is never invoked, hence control is not passed on to toad_nokogiri_xml_document.
In general, mocking and stubbing methods on the object your testing should be avoided, for exactly this reason.
HTH,
David
More information about the rspec-users
mailing list