I’m reading stuff from ‘Agile Web development With Ruby on Rails’ (p
Anyway, they say that there is a variable that contains all the data
from the fixture!
@address = Address.find(1)
data = @addresses[“first”] # this is line 11
assert_kind_of Address, @address
assert_equal data[“id”], @address.id
So assumed is that all data from the fixture is loaded into the hash
@addresses. But Running this test I get an error on @addresses:
Loaded suite address_test
Finished in 0.125989 seconds.
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.
3 tests, 4 assertions, 0 failures, 1 errors
So it seems there is no @addresses
Any suggestions why this hash is empty ?
Thnx a lot
ps my fixture looke something like