@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?
@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?
On Sat, Jun 27, 2009 at 9:55 AM, Zhenning G.[email protected]
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
David C. wrote:
clear, thank you David
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 ?
On Sat, Jun 27, 2009 at 10:55 AM, Zhenning G.[email protected]
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs