[rspec-users] what does :save => true mean in mock_model ?

David Chelimsky dchelimsky at gmail.com
Sat Jun 27 11:02:52 EDT 2009


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
>


More information about the rspec-users mailing list