Zhenning Guan
2009-Jun-27 14:55 UTC
[rspec-users] what does :save => true mean in mock_model ?
@weather = mock_model(Weather, :id => "1") @forecast = mock_model(Forecast, :weather => @weather, :save => true) what''s the different between with :save => true or without it? -- Posted via http://www.ruby-forum.com/.
David Chelimsky
2009-Jun-27 15:02 UTC
[rspec-users] what does :save => true mean in mock_model ?
On Sat, Jun 27, 2009 at 9:55 AM, Zhenning Guan<lists at ruby-forum.com> wrote:> @weather ?= mock_model(Weather, :id => "1") > @forecast = mock_model(Forecast, :weather => @weather, :save => true) > > what''s the different between with :save => true or without it?The hash submitted to mock_model sets up method stubs: @weather.save => MockExpectationError "received unexpected message ''save''" @forecast.save => true HTH, David> -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Zhenning Guan
2009-Jun-27 15:52 UTC
[rspec-users] what does :save => true mean in mock_model ?
David Chelimsky wrote: clear, thank you David -- Posted via http://www.ruby-forum.com/.
Zhenning Guan
2009-Jun-27 15:55 UTC
[rspec-users] what does :save => true mean in mock_model ?
one more question. Forecast.stub!(:new).and_return(@forecast) Forecast.should_receive(:new).with(anything()).and_return(@forecast) what''s the different between stub! and should_receive ? -- Posted via http://www.ruby-forum.com/.
David Chelimsky
2009-Jun-27 16:15 UTC
[rspec-users] what does :save => true mean in mock_model ?
On Sat, Jun 27, 2009 at 10:55 AM, Zhenning Guan<lists at ruby-forum.com> wrote:> one more question. > Forecast.stub!(:new).and_return(@forecast) > Forecast.should_receive(:new).with(anything()).and_return(@forecast) > > what''s the different between stub! and should_receive ?Read this: http://rspec.info/documentation/mocks/ and then feel free to ask questions about anything you don''t understand. Cheers, David