10.1 Iteration E1: Creating a Smarter Cart 9.3 Iteration D3: Adding a button
Once again, get the tests working, and add tests for the smarter cart.
See that the tests fail.
rake test
(in /home/rubys/svn/rails4/Book/util/work-188/depot)
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.8-r28169%global/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.......
Finished in 0.082068 seconds.
7 tests, 25 assertions, 0 failures, 0 errors
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.8-r28169%global/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.......E..............
Finished in 0.403369 seconds.
1) Error:
test_should_create_line_item(LineItemsControllerTest):
ActiveRecord::RecordNotFound: Couldn't find Product without an ID
app/controllers/line_items_controller.rb:46:in `create'
test/functional/line_items_controller_test.rb:21:in `test_should_create_line_item'
test/functional/line_items_controller_test.rb:20:in `test_should_create_line_item'
22 tests, 33 assertions, 0 failures, 1 errors
Errors running test:functionals!
Update parameters passed as well as expected target of redirect
edit test/functional/line_items_controller_test.rb
test "should create line_item" do
assert_difference('LineItem.count') do
post :create, :product_id => products(:ruby).id
end
assert_redirected_to cart_path(LineItem.last.cart_id)
end
rake test
(in /home/rubys/svn/rails4/Book/util/work-188/depot)
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.8-r28169%global/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.......
Finished in 0.084828 seconds.
7 tests, 25 assertions, 0 failures, 0 errors
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.8-r28169%global/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
......................
Finished in 0.412243 seconds.
22 tests, 35 assertions, 0 failures, 0 errors
10.1 Iteration E1: Creating a Smarter Cart 9.3 Iteration D3: Adding a button