Displaying 1 result from an estimated 1 matches for "line_item_controller_test".
Did you mean:
line_items_controller_test
2013 Sep 23
1
redirect on browser success, but redirect on functional test is error
..._item.rb:
belongs_to :product
belongs_to :cart
line_item_controller.rb:
def destroy
@line_item = LineItem.find(params[:id])
@cart = @line_item.cart
@line_item.destroy
respond_to do |format|
format.html { redirect_to @cart }
format.json { head :no_content }
end
end
line_item_controller_test.rb:
setup do
@line_item = line_items(:one)
end
test "should destroy line_item" do
@cart = @line_item.cart
assert_difference(''LineItem.count'', -1) do
delete :destroy, id: @line_item
end
assert_redirected_to @cart
end
------...