Hi – I am just getting to grips w/ view specs, and am having an issue
with mock_model not stubbing the mocked model’s attributes.
For instance, I have the following:
@input_timesheet = mock_model( InputTimesheet )
assigns[:input_timesheet] = @input_timesheet
it “should display a table element” do
response.should have_tag( ‘table’ )
Obviously, the view calls for a number of attributes from the
@input_timesheet, but unless I explicitly define these in the mock_model
method, I get the following kind of error:
ActionView::TemplateError in ‘/input_timesheets/edit.rhtml should
display expected InputTimesheet details’ Mock ‘InputTimesheet_1000’
received unexpected message :comments with (no args)
Can anyone offer any advice as to why this should be?
(Maybe it’s supposed to be like this for views?)