According to the book, @timesheets[“first_timesheet”] should be
accesible from within my functional test, but its not!
Timesheets.yml :
first_timesheet:
status: 2
start_date: 2006-04-24
cost: 10
employee: 444
id: 10683
charge: 20
My Test :
class AdminTimesheetsControllerTest < Test::Unit::TestCase
fixtures :timesheets
def test_viewTimesheet
get :viewTimesheet,:id=>@timesheets[“first_timesheet”].id
assert_template ‘viewTimesheet’
end
end
The error :
test_viewTimesheet(AdminTimesheetsControllerTest):
NoMethodError: You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]
test/functional/admin_timesheets_controller_test.rb::in
`test_viewTimeshee
t’
any ideas why i cant access it?
Thanks
Andy