[rspec-users] Mocking User.find( :all, :limit => 10 )

Johan Sørensen johan at johansorensen.com
Mon Jul 9 11:42:45 EDT 2007

On Jul 9, 2007, at 5:38 PM, Josh Knowles wrote:

> On 7/9/07, Johan Sørensen <johan at johansorensen.com> wrote:
> Is there a way in RSpec to check for a specific hash key (or  
> evaluating other things along those lines) in the parameter  
> expectation using the should_receive(:find).with(...) construct?
> As opposed to getting into complicated mocking scenarios, consider  
> abstracting this logic into your model: http://blog.caboo.se/ 
> articles/2007/6/19/rspec-notes-from-the-trenches-2

Well, that's where it is, and for various reasons writing to the  
database is something I'm avoiding as long as I can (speedy tests and  
complex fk constraints being a few of them). I'm still not convinced  
that it's a good idea to do that for model specs, but that's another  
topic ;)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070709/661f9da8/attachment.html 

More information about the rspec-users mailing list