small medium large xlarge

Generic-user-small
25 Jul 2014, 21:13
Jason Hsu (12 posts)

In the section “A Real Unit Test” (page 97 of the pdf, page 83 of the book), the command “rake test” yields failing tests, contrary to what the text specifies. The error messages are:

1) Error: ProductTest#test_product_is_not_valid_without_a_unique_title: StandardError: No fixture named ‘ruby’ found for fixture set ‘products’ test/models/product_test.rb:61:in `block in '

2) Error: ProductTest#test_product_is_not_valid_without_a_unique_title_-_i18n: StandardError: No fixture named ‘ruby’ found for fixture set ‘products’ test/models/product_test.rb:71:in `block in '

Generic-user-small
25 Jul 2014, 21:22
Jason Hsu (12 posts)

To make the tests pass, you need to correct the test/models/product_test.rb file. On line 61, you need to replace “products(:ruby)” with “products(:one)”. On line 71, you need to replace “products(:ruby)” with “products(:two)”.

If you look at the test/models/product_test.rb file, you’ll see that the two fixtures provided are named “one” and “two” instead of “ruby”. This gives the product model test access to the titles specified in the fixtures.

Jac_pragsmall
28 Apr 2015, 14:00
Jacqueline S. Homan (1 post)

I’ve been having a LOT of problems getting this depot app to work for me, starting at the point where Jason Hsu is referencing. I am using Rails 4.2.1 and Ruby v2.1.2 p95. I tried those suggestions and it still did not work for me so I just changed my code back to what I had with the ~~~products(:ruby)~~~ thing I had originally (following the book’s example to the letter). Then, when I got to the section on putting together the cart, it would not work for me at all. I got a NameError in Carts#show. I Googled looking for help to solve the problem but came up short. I was referred to this forum. I am extremely disappointed and do not feel the money I really couldn’t afford to spend on this book was a good investment.

You must be logged in to comment