Sha256: 2a3421a3e778b7adc602a71df4e04e94d3c64be197c6b8c697b7304a810be988

Contents?: true

Size: 1.01 KB

Versions: 10

Compression:

Stored size: 1.01 KB

Contents

require 'test_helper'

module Admin
  class ProductsControllerTest < ActionController::TestCase
    setup do
      @product = create(:product)
    end

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

    test "should get show" do
      get :show, id: @product
      assert_response :success
    end

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

    test "should get edit" do
      get :edit, id: @product
      assert_response :success
    end

    test "should create" do
      assert_difference('Product.count') do
        post :create, product: {name: 'Hello'}
      end
      assert_response 302
    end

    test "should update" do
      patch :update, id: @product, product: {name: 'Hello'}
      assert_redirected_to admin_product_path(@product)
    end

    test "should destroy" do
      assert_difference('Product.count', -1) do
        delete :destroy, id: @product
      end
      assert_redirected_to admin_products_path
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
iord-1.2.2 test/controllers/admin/products_controller_test.rb
iord-1.2.1 test/controllers/admin/products_controller_test.rb
iord-1.2.0 test/controllers/admin/products_controller_test.rb
iord-1.1.3 test/controllers/admin/products_controller_test.rb
iord-1.1.2 test/controllers/admin/products_controller_test.rb
iord-1.1.1 test/controllers/admin/products_controller_test.rb
iord-1.1.0 test/controllers/admin/products_controller_test.rb
iord-1.0.3 test/controllers/admin/products_controller_test.rb
iord-1.0.2 test/controllers/admin/products_controller_test.rb
iord-1.0.1 test/controllers/admin/products_controller_test.rb