Created
February 1, 2016 19:14
-
-
Save rubys/17c34d8d99f8f5fb3ad8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
equire 'test_helper' | |
class CartsControllerTest < ActionDispatch::IntegrationTest | |
setup do | |
@cart = carts(:one) | |
end | |
test "should get index" do | |
get carts_url | |
assert_response :success | |
end | |
test "should get new" do | |
get new_cart_url | |
assert_response :success | |
end | |
test "should create cart" do | |
assert_difference('Cart.count') do | |
post carts_url, params: { cart: { title: @cart.title } } | |
end | |
assert_redirected_to cart_path(Cart.last) | |
end | |
test "should show cart" do | |
get cart_url(@cart) | |
assert_response :success | |
end | |
test "should get edit" do | |
get edit_cart_url(@cart) | |
assert_response :success | |
end | |
test "should update cart" do | |
patch cart_url(@cart), params: { cart: { title: @cart.title } } | |
assert_redirected_to cart_path(@cart) | |
end | |
test "should destroy cart" do | |
post line_items_url, params: { product_id: products(:ruby).id } | |
follow_redirect! | |
assert_difference('Cart.count', 0) do | |
delete css_select('form')['action'] | |
end | |
assert_redirected_to store_path | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment