[mocha-developer] Rails functional testing and Mocha

Frederick Cheung fred at 82ask.com
Mon Mar 5 06:48:48 EST 2007


On 5 Mar 2007, at 11:15, James Mead wrote:

> Hi Fred,
>
> It's great to see you playing around with the internals of Mocha. I  
> hope
> you've been having fun!
>
> I use the same technique that David describes (although I'd  
> probably stub
> the call to find not expect it, because its a query not a command).
> In fact I rarely use the any_instance form of stubbing. It feels a bit
> dirty!
>
> I don't think we'd want to incorporate the change you're  
> suggesting, because
> (as you say) its a bit ActiveRecord-specific and there is an  
> alternative.
>
> Is there anything you don't like about the technique David suggests  
> (i.e.
> stubbing the find method)?
>
I like it very much actually. In general though I am a little nervous  
about testing everything in isolation i.e. models in their unit tests  
controllers & views in their functional etc...
I like knowing that I've taken a complete path through the system.  
Perhaps some of my functional tests should actually be integration  
tests but that doesn't really make a distance here. I can also see it  
getting a little hairy if you're faking up the finding of multiple  
objects, with associations etc...

Fred


More information about the mocha-developer mailing list