On Oct 5, 2008, at 5:04 PM, Matt Wynne wrote:
On 5 Oct 2008, at 21:56, Scott Taylor wrote:
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.
So does this suggest there's something wrong with Greg's design?
Does he maybe need to sprout a new class to handle the generation of
the transactions, and pass that a specific BankAccount instance?
Well, Look at this comment previously written in the thread:
Do people normal use the "any_instance.stubs" approach to stub out
existing classes already developed, as a means to minimize
associated
Notice "existing classes" - this usually means classes that haven't
been developed test first. if they had been developed test first,
they'd probably be trivial to test with.
Scott
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users