You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

49 regels
1.2 KiB

  1. require 'test_helper'
  2. class LineItemsControllerTest < ActionDispatch::IntegrationTest
  3. setup do
  4. @line_item = line_items(:one)
  5. end
  6. test "should get index" do
  7. get line_items_url
  8. assert_response :success
  9. end
  10. test "should get new" do
  11. get new_line_item_url
  12. assert_response :success
  13. end
  14. test "should create line_item" do
  15. assert_difference('LineItem.count') do
  16. post line_items_url, params: { line_item: { cart_id: @line_item.cart_id, product_id: @line_item.product_id } }
  17. end
  18. assert_redirected_to line_item_url(LineItem.last)
  19. end
  20. test "should show line_item" do
  21. get line_item_url(@line_item)
  22. assert_response :success
  23. end
  24. test "should get edit" do
  25. get edit_line_item_url(@line_item)
  26. assert_response :success
  27. end
  28. test "should update line_item" do
  29. patch line_item_url(@line_item), params: { line_item: { cart_id: @line_item.cart_id, product_id: @line_item.product_id } }
  30. assert_redirected_to line_item_url(@line_item)
  31. end
  32. test "should destroy line_item" do
  33. assert_difference('LineItem.count', -1) do
  34. delete line_item_url(@line_item)
  35. end
  36. assert_redirected_to line_items_url
  37. end
  38. end