I am desperately in need of functionality such as Mocha offers with
their any_instance method. I see that there is an open ticket for a
similar feature in RSpec, but it does not look like anything have been
done. Is there any other way around this?
<br><br><a href="https://rubyforge.org/tracker/index.php?func=detail&aid=6791&group_id=797&atid=3152" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://rubyforge.org/tracker/index.php?func=detail&aid=6791&group_id=797&atid=3152
</a><br><br>
Here is what I am doing, and why I feel I need this (maybe my design is inherently wrong)<br><br>Given a model called Foo<br><br>def Foo.create_from_form<br> foo = Foo.new<br> # Do all kinds of crazy stuff here<br> foo.save
<br>end<br><br>In my specs I want to stub the foo.save call to return
true or false depending on the case, so that it doesn't actually try
and save to the DB... is there any way around this since I do not
actually know the instance of the class I am trying to stub?
<br><span class="sg"><br>Shane</span>