Rémi Gagnon <[EMAIL PROTECTED]> writes:

> Let's see, I want to spec the :conditions args to make sure the right
> args is passed to the query.
>
> Product.find(:all,
>       :conditions => ["inte_no = ? and vaat_id_type_statut_pcpa = ?",
> inte_no, 7],
>       :limit => 2,
>       :order => "trns_dt_appl_prod desc")
>
>
> 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
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to