[rspec-users] spec'ing the :conditions argument of a find

Rémi Gagnon lists at ruby-forum.com
Thu Oct 30 11:41:43 EDT 2008

I do agree, That's what we're gonna do. it was just an example.
But what if we want to test find_thingy(in model spec) to make sure the 
:conditions is set properly?


Pat Maddox wrote:
> Rémi Gagnon <lists at ruby-forum.com> writes:
>> Product.should_receive(:find).with(:conditions =>
>> 'vaat_id_type_statut_pcpa == 7)
>> I'm pretty sure this is not the right synthax.
>> Any suggestions?
>> Rémi
> ewww......brittle, ugly, and not encapsulated.  Why don't you create a
> method to wrap this find?  Product.find_thingy(1, 2).  Then mocking
> becomes trivial and clean:
> Product.should_receive(:find_thingy).with(1,2)
> Pat

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list