I’m fairly new to Rails, and I’ve been learning from AGILE WEB
DEVELOPMENT WITH RAILS. Everything has been going smoothly until the
chapter on Unit Testing, where I’m getting some strange errors.
I’m up to page 141 in the Agile book, and attempting to run the test
program containing the method test_read_with_hash. The previous tests
work properly, but I don’t seem to be able to refer to the fixtures
through its variable.
The file “product_test.rb” contains the line “fixtures :products”, which
says it should set up the variable @fixtures through which I can refer
to my fixtures. My “products.yml” fixture file is exactly as downloaded
from the Agile Web Dev site, I’ve checked it for syntax and spelling and
tabs-instead-of-spaces and the like.
“product_test.rb”, in the method “test_read_with_hash” contains this
vc_book = @products["version_control_book"]
When I run product_test.rb, I get a NoMethodError on this line:
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.
My actual “depot” application works perfectly as far as I can tell, and
I’d like to debug this but I’m not sure how to trace it back. What
could cause this error, how would I go about finding it?
Thanks in advance,