09 Dec 2011, 02:38
Weston Dyer (1 post)
I just finished adding the code to fix the test errors for ‘line_items’ for nil:Class and ran rake test. I get 1 Failure: test_should_destroy_cart
I have been comparing my coded to the code from the book for the cart controller and i have not touched the default carts_controller_test. Can anyone point me in the right direction to track down this error ?
Thank you in advance
07 Mar 2013, 08:06
Igor Biscanin (1 post)
I have the same problem:
test “should destroy cart” do
Finished tests in 0.735352s, 31.2775 tests/s, 48.9561 assertions/s.
02 Apr 2013, 16:01
Psist Wu (2 posts)
I am using rails 3.2.13 and ruby 1.9.3p0, and I also encountered the same problem.
I then tried to add and destroy carts manually by web interface, but it behaved strange. For create action, when there is no cart, it creates two. For destroy action, when there is only one cart left, it destroys it but creates a new one at the same time.
The test above led me to the cause of the problem: the line in the controller
I simply comment out the line shown above and the problem is gone.
My solution seems contradicting to author’s intention to protect one’s cart from others, but I don’t have any better alternative for now.
Anyone could share his/her experience or opinion would be appreciated.
Later in chapter 10, the author modified the test “
|You must be logged in to comment|