Tero Tilus
2009-Feb-19 18:34 UTC
[rspec-users] ActiveRecord::Base.should_receive(:find) fails
I''ve got an AR-model with some find-magic I want to test. When I have ActiveRecord::Base.should_receive(:find).with(anything(),assert_options) MyModel.find(:all,find_options) in my example find-method somehow disappears alltogether and I get NoMethodError in ''MyModel find-options are passed on correctly'' undefined method `find'' for MyModel And docs tell that (at least something really close to that one) should work http://rspec.info/documentation/mocks/partial_mocks.html -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
David Chelimsky
2009-Feb-19 18:47 UTC
[rspec-users] ActiveRecord::Base.should_receive(:find) fails
On Thu, Feb 19, 2009 at 12:34 PM, Tero Tilus <tero at tilus.net> wrote:> I''ve got an AR-model with some find-magic I want to test. When I have > > ActiveRecord::Base.should_receive(:find).with(anything(),assert_options) > MyModel.find(:all,find_options)MyModel != ActiveRecord::Base Try this MyModel.should_receive(:find).with(anything(),assert_options) MyModel.find(:all,find_options)> > in my example find-method somehow disappears alltogether and I get > > NoMethodError in ''MyModel find-options are passed on correctly'' > undefined method `find'' for MyModel > > And docs tell that (at least something really close to that one) > should work > > http://rspec.info/documentation/mocks/partial_mocks.html > > -- > Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/ > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >