What version of rails are you running? I think testing changed in 1.1,
which is biting me right now - try using
timesheets("first_timesheet") and
see if it works.
Dan.
On 5/3/06, Andy <andypeters@gmail.com> wrote:>
> 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
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Dan Venkitachalam
expandingbrain.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060503/105163fa/attachment.html