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


_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to