small medium large xlarge

Generic-user-small
21 Apr 2011, 03:23
David Nehme (2 posts)

I’m running the functional tests for TASK_F and am getting an error in the line_item_controller_test.
The test is ` test “should create line_item” do assert_difference(‘LineItem.count’) do post :create, :line_item => @line_item.attributes end end ` Without touching the code, the error message is ` ActiveRecord::RecordNotFound: Couldn’t find Product without an ID `

I added the line ` assert_not_nil @line_item.attributes[:product_id], @line_item.attributes.to_s() `

before the assert_difference and get the message ` 1) Failure: test_should_create_line_item(LineItemsControllerTest) [test/functional/line_items_controller_test.rb:30]: {“cart_id”=>1, “created_at”=>2011-04-21 03:19:16 UTC, “id”=>980190962, “product_id”=>1, “updated_at”=>2011-04-21 03:19:16 UTC}.

expected to not be nil. ` It looks like the keys for the attributes are strings instead of the expected symbols. I'm using RVM on ubuntu 10.10, rails 3.0.5 ` ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] ` Am I missing something or is there something wrong with my installation?
You must be logged in to comment