On Thu, Mar 6, 2008 at 5:50 AM, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> On Thu, Mar 6, 2008 at 1:01 AM, Pat Maddox <[EMAIL PROTECTED]> wrote:
>  >
>  >  >  >  >>> On Wed, Mar 5, 2008 at 12:28 PM, Rick DeNatale <[EMAIL 
> PROTECTED]
>  >  >  >  >>>> wrote:
>  >  >  >  >>>> So I want to write something like this, say in a controller 
> spec
>  >  >  >  >>>>
>  >  >  >  >>>>  User.should_receive(:find).with(:all, 
> hash_with_at_least(:order =>
>  >  >  >  >>>> 'user.name ASC'))
>  >  >  >  >>>>  get 'index', :sort => 'up'
<snip>
>  >  Am I the only one that hates this whole thing and thinks it ought to be
>  >  User.should_receive(:all_sorted_by_name) ?
>
>  But wouldn't you want that spec'd on the model?

Yes, but my spec would hit the db.  (1) I feel icky specifying the
call to find so precisely (2) the behavior that I want is to find
stuff in a certain order, the fact that it uses AR is an
implementation detail (3) "don't mock APIs you don't own"

However I can also +1 Ben Mabey's reply that partial hash matching is
an interesting problem in its own right.

Pat
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to