Sha256: c3fee42caa1becbaa715522476eaadbb918442eeb7311951d74f13cbddf0e949

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

require 'test_helper'

module Ecom
  class ProductsControllerTest < ActionDispatch::IntegrationTest
    include Engine.routes.url_helpers

    setup do
      @product = ecom_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: { base_price: @product.base_price, description: @product.description, name: @product.name, size: @product.size } }
      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: { base_price: @product.base_price, description: @product.description, name: @product.name, size: @product.size } }
      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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ecom-0.2.0 test/controllers/ecom/products_controller_test.rb