On Thu, Mar 6, 2008 at 12:52 AM, Zach Dennis <[EMAIL PROTECTED]> wrote: > On Wed, Mar 5, 2008 at 12:28 PM, Rick DeNatale <[EMAIL PROTECTED]> wrote: > > > I'm wanting to write a spec that a model is applying an :order option > > to a find call, but I don't want to completely specify all of the find > > parameters. > > > > 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'
RSpec has similar parameter matching: http://blog.davidchelimsky.net/articles/2007/02/25/matchers-doing-double-duty That's why Rick is talking about writing a parameter matcher :) > > > > This ability to partially specify the contents of a hash argument > > seems to be generally useful, particularly for Rails, and was > > wondering if anyone had done this. I don't think it would be too hard. > > Are you just wanting Mocha parameter matching? > > User.should_receive(:find).with(:all, has_entry(:order => 'user.name ASC')) > get 'index', :sort => 'up' > > -- > Zach Dennis > http://www.continuousthinking.com > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users