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
937 B

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