[rspec-users] would I stub an existing class method out or use fixtures in this scenario?

Matt Wynne matt at mattwynne.net
Sun Oct 5 17:04:11 EDT 2008

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?

More information about the rspec-users mailing list