Sha256: 98df402c4217d51808fc385241b8d6a5002d7df218951765d2f06e8dffc364d1

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

class ProductsControllerTest < ActionDispatch::IntegrationTest
  setup do
    @product = products(:one)
  end

  test "should get index" do
    get products_url
    assert_response :success
  end

  test "should get new" do
    get new_product_url
    assert_response :success
  end

  test "should create product" do
    assert_difference('Product.count') do
      post products_url, params: { product: { name: @product.name } }
    end

    assert_redirected_to product_url(Product.last)
  end

  test "should show product" do
    get product_url(@product)
    assert_response :success
  end

  test "should get edit" do
    get edit_product_url(@product)
    assert_response :success
  end

  test "should update product" do
    patch product_url(@product), params: { product: { name: @product.name } }
    assert_redirected_to product_url(@product)
  end

  test "should destroy product" do
    assert_difference('Product.count', -1) do
      delete product_url(@product)
    end

    assert_redirected_to products_url
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
autocompl-0.2.2 test/dummy/test/controllers/products_controller_test.rb
autocompl-0.2.1 test/dummy/test/controllers/products_controller_test.rb
autocompl-0.2.0 test/dummy/test/controllers/products_controller_test.rb
autocompl-0.1.2 test/dummy/test/controllers/products_controller_test.rb
autocompl-0.1.1 test/dummy/test/controllers/products_controller_test.rb
autocompl-0.1.0 test/dummy/test/controllers/products_controller_test.rb
autocompl-0.0.1 test/dummy/test/controllers/products_controller_test.rb