small medium large xlarge

10 Jun 2016, 11:28
Nathan Ruehs (1 post)

Has anyone run into problems running the control test in chapter 10?

I am on Page 142 (Beta 4) and trying to run some the control test and get the following 3 errors. Not sure if its something I messed up or if the tests need to be updated.

ProductsControllerTest#test_should_destroy_product [/home/ubuntu/workspace/syrup/test/controllers/products_controller_test.rb:52]:
"Product.count" didn't change by -1.
Expected: 2
  Actual: 3

Test Log:

ProductsControllerTest: test_should_destroy_product
  Product Load (0.2ms)  SELECT  "products".* FROM "products" WHERE "products"."id" = ? LIMIT ?  [["id", 980190962], ["LIMIT", 1]]
   (0.1ms)  SELECT COUNT(*) FROM "products"
Started DELETE "/products/980190962" for at 2016-06-10 11:16:57 +0000
Processing by ProductsController#destroy as HTML
  Parameters: {"id"=>"980190962"}
  Product Load (0.2ms)  SELECT  "products".* FROM "products" WHERE "products"."id" = ? LIMIT ?  [["id", 980190962], ["LIMIT", 1]]
   (0.1ms)  SAVEPOINT active_record_1
  LineItem Exists (1.2ms)  SELECT  1 AS one FROM "line_items" WHERE "line_items"."product_id" = ? LIMIT ?  [["product_id", 980190962], ["LIMIT", 1]]
   (0.1ms)  ROLLBACK TO SAVEPOINT active_record_1
Redirected to
Completed 302 Found in 51ms (ActiveRecord: 1.5ms)
   (1.2ms)  SELECT COUNT(*) FROM "products"
   (0.1ms)  rollback transaction
   (0.1ms)  begin transaction

Thought the test might be trying to delete a product that is in a cart? But not sure how to prove that or fix it


LineItemsControllerTest#test_should_create_line_item [/home/ubuntu/workspace/syrup/test/controllers/line_items_controller_test.rb:26]:
<Programming Ruby 1.9> expected but was
Expected 0 to be >= 1.

Thought this might be cause we stuff we added to application.html.erb on page 153

You must be logged in to comment