Agile Web Development with Rails 7: Page 118 : Test fails

@rubys

Following through the book but using Rails 7.1.2.

When trying to run the test on page 118 I get -
`

Error:
ProductsControllerTest#test_can't_delete_product_in_cart:
ActiveRecord::RecordNotDestroyed: Failed to destroy Product with id=298486374
    app/controllers/products_controller.rb:52:in `destroy'
    test/controllers/products_controller_test.rb:58:in `block (2 levels) in <class:ProductsControllerTest>'
    test/controllers/products_controller_test.rb:57:in `block in <class:ProductsControllerTest>'


bin/rails test test/controllers/products_controller_test.rb:56


Finished in 0.706042s, 39.6577 runs/s, 86.3971 assertions/s.
28 runs, 61 assertions, 0 failures, 1 errors, 0 skips

Is this because of the different Rails version, or is this test not meant to pass?

1 Like