On Oct 5, 2008, at 4:47 PM, Matt Wynne wrote:
On 5 Oct 2008, at 12:26, Greg Hauptmann wrote:
BankAccount.any_instance.stubs(:balance?).returns(<as required>)).
Do people normal use the "any_instance.stubs" approach to stub out
existing classes already developed, as a means to minimize associated
Is this any_instance thing in the rspec mocking framework now? I
vaguely remember wanting this a few weeks ago and it was only in
mocha or another of the competing mocking frameworks.
No, it isn't. Most consider it a code smell, which is why it hasn't
been high on the priority list.
I submitted a patch a while back for this (see: http://rspec.lighthouseapp.com/projects/5645/tickets/28-6791-stub-return-values-for-all-instances-of-a-class#ticket-28-5)
, which wasn't accepted into core for asthetic reasons. Feel free to
revise it ;)
Scott
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users