Hi all,
I’m working on the rails book and the test definition shown further
below
gives the following error.
test_read_with_hash(ProductTest):
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/unit/product_test.rb:45:in `test_read_with_hash’
4 tests, 15 assertions, 0 failures, 1 errors
def test_read_with_hash
assert_kind_of Product, @product
vc_book = @products[“version_control_book”] << line 45
assert_equal vc_book[“id”], @product.id
assert_equal vc_book[“title”], @product.title
assert_equal vc_book[“description”], @product.description
assert_equal vc_book[“image_url”], @product.image_url
assert_equal vc_book[“price”], @product.price
assert_equal vc_book[“date_available”],
@product.date_available_before_type_cast
end
Fixture in question:
version_control_book:
id: 1
title: Pragmatic Version Control
description: How to use version control
image_url: http://…/sk_svn_small.jpg
price: 29.95
date_available: 2005-01-26 00:00:00
I’m clueless … Thanx a lot
Regards,
Gerard.
–
“Who cares if it doesn’t do anything? It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process …”
My $Grtz =~ Gerard;
~
:wq!