[rspec-users] stub! and stubs

Lee Hambley lee.hambley at gmail.com
Tue Oct 13 10:33:44 EDT 2009


Sam,

As the .any_instance call suggests, anything ever again for the duration of
the test will stub that value, the alternative is this:

Foo.any_instance.stubs(:valid?).returns(false)

replace with this

foo = Foo.new
foo.stubs(:valid?).returns(false)

HTH

- Lee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091013/66f816ad/attachment.html>


More information about the rspec-users mailing list