Hi All
I''m reading stuff from ''Agile Web development With Ruby on
Rails'' (p
141)
Anyway, they say that there is a variable that contains all the data
from the fixture!
Example:
fixtures :address
def setup
@address = Address.find(1)
end
def test_create
data = @addresses["first"] # this is line 11
assert_kind_of Address, @address
assert_equal data["id"], @address.id
..... etc....
end
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
Started
E..
Finished in 0.125989 seconds.
1) Error:
test_create(AddressTest):
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.[]
address_test.rb:11:in `test_create''
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
LuCa
ps my fixture looke something like
first:
id: 1
...
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---