On Jun 23, 2011, at 3:55 PM, S Ahmed wrote: > Thanks. > > I'm trying this now on a Model that is using Mongoid. > > I have tried: > > it "should ..." do > > User.stub(:some_call).and_return(User.new(:name => "blah")) > > end > > And when running spec on this file I get: > > NoMethodError, undefined method "stub" for User:Class > > I also tried: > > User.stub!(:some_call).... > > Does this not work on mongoid objects?
It should work on any object (class objects and instance objects), so it sounds like there is a configuration problem. What's in your Gemfile? > > On Fri, Jun 17, 2011 at 7:39 PM, Patrick J. Collins > <patr...@collinatorstudios.com> wrote: > > but what if my method looks like: > > > > user = User.where("...") > > user2 = User.where("...") > User.should_receive(:where).with("...").and_return(...) > http://apidock.com/rspec/Spec/Mocks > > Patrick J. Collins > http://collinatorstudios.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 Cheers, David
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users