10.1 Iteration E1: Creating a Smarter Cart 9.3 Iteration D3: Adding a button
7 (tests|runs), 13 assertions, 0 failures, 0 errors. <0> expected to be >= <1>. Traceback: /home/rubys/git/awdwr/edition4/checkdepot.rb:36:in `assert_test_summary' /home/rubys/git/awdwr/edition4/checkdepot.rb:153:in `block in <class:DepotTest>'
Once again, get the tests working, and add tests for the smarter cart.
See that the tests fail.
rake test
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from rescue in <class:Exception> at /home/rubys/.rvm/gems/ruby-head-n50123/gems/web-console-2.1.2/lib/web_console/integration/cruby.rb:37)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from block in <top (required)> at /home/rubys/.rvm/gems/ruby-head-n50123/gems/web-console-2.1.2/lib/web_console/extensions.rb:18)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from included at /home/rubys/.rvm/gems/ruby-head-n50123/gems/turbolinks-2.5.3/lib/turbolinks/xhr_url_for.rb:7)
Run options: --seed 30359
# Running:
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from block (3 levels) in <class:Engine> at /home/rubys/.rvm/gems/ruby-head-n50123/gems/turbolinks-2.5.3/lib/turbolinks.rb:14)
DEPRECATION WARNING: after_filter is deprecated and will be removed in Rails 5.1. Use after_action instead. (called from block (3 levels) in <class:Engine> at /home/rubys/.rvm/gems/ruby-head-n50123/gems/turbolinks-2.5.3/lib/turbolinks.rb:15)
..............E.....E..E...
Finished in 0.279571s, 96.5767 runs/s, 211.0379 assertions/s.
1) Error:
LineItemsControllerTest#test_should_create_line_item:
ActiveRecord::RecordNotFound: Couldn't find Product with 'id'=
app/controllers/line_items_controller.rb:35:in `create'
test/controllers/line_items_controller_test.rb:21:in `block (2 levels) in <class:LineItemsControllerTest>'
test/controllers/line_items_controller_test.rb:20:in `block in <class:LineItemsControllerTest>'
2) Error:
ProductsControllerTest#test_should_create_product:
ActionController::ParameterMissing: param is missing or the value is empty: product
app/controllers/products_controller.rb:79:in `product_params'
app/controllers/products_controller.rb:27:in `create'
test/controllers/products_controller_test.rb:34:in `block (2 levels) in <class:ProductsControllerTest>'
test/controllers/products_controller_test.rb:32:in `block in <class:ProductsControllerTest>'
3) Error:
ProductsControllerTest#test_should_update_product:
ActionController::UrlGenerationError: No route matches {:action=>"update", :controller=>"products", :description=>"Wibbles are fun!", :image_url=>"lorem.jpg", :price=>"19.95", :title=>"Lorem Ipsum"}
test/controllers/products_controller_test.rb:57:in `block in <class:ProductsControllerTest>'
27 runs, 59 assertions, 0 failures, 3 errors, 0 skips
Failed tests:
bin/rails test /home/rubys/git/awdwr/edition4/work-220/depot/test/controllers/line_items_controller_test.rb:19
bin/rails test /home/rubys/git/awdwr/edition4/work-220/depot/test/controllers/products_controller_test.rb:31
bin/rails test /home/rubys/git/awdwr/edition4/work-220/depot/test/controllers/products_controller_test.rb:55
Update parameters passed as well as expected target of redirect
edit test/controllers/line_items_controller_test.rb
test "should create line_item" do
assert_difference('LineItem.count') do
post :create, params: { product_id: products(:ruby).id
end
assert_redirected_to cart_path(assigns(:line_item).cart)
end
Rerun the previously failing test to verify the fix.
rake test test/controllers/line_items_controller_test.rb
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from rescue in <class:Exception> at /home/rubys/.rvm/gems/ruby-head-n50123/gems/web-console-2.1.2/lib/web_console/integration/cruby.rb:37)
rake aborted!
SyntaxError: /home/rubys/git/awdwr/edition4/work-220/depot/test/controllers/line_items_controller_test.rb:25: syntax error, unexpected keyword_end, expecting '}'
/home/rubys/git/awdwr/edition4/work-220/depot/test/controllers/line_items_controller_test.rb:55: syntax error, unexpected end-of-input, expecting keyword_end
/home/rubys/git/rails/railties/lib/rails/test_unit/runner.rb:118:in `require'
/home/rubys/git/rails/railties/lib/rails/test_unit/runner.rb:118:in `block in run_tests'
/home/rubys/git/rails/railties/lib/rails/test_unit/runner.rb:117:in `each'
/home/rubys/git/rails/railties/lib/rails/test_unit/runner.rb:117:in `run_tests'
/home/rubys/git/rails/railties/lib/rails/test_unit/runner.rb:88:in `run'
/home/rubys/git/rails/railties/lib/rails/test_unit/runner.rb:82:in `run'
/home/rubys/git/rails/railties/lib/rails/test_unit/testing.rake:9:in `block in <top (required)>'
Tasks: TOP => test
(See full trace by running task with --trace)
10.1 Iteration E1: Creating a Smarter Cart 9.3 Iteration D3: Adding a button