[rspec-users] Rspec

Curtis j Schofield curtis.schofield at gmail.com
Mon Jun 28 16:03:18 EDT 2010


Any suggestions for how to detect that the methods are getting
executed that need to get executed?


On Mon, Jun 28, 2010 at 11:50 AM, David Chelimsky <dchelimsky at gmail.com> wrote:
> 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 at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list