Sha256: 6a70a6a53f592f8efbf22201772c215cc08b4f4c8a54cee2dd7f4b32a423299b

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'

class ProductsControllerTest < ActionController::TestCase
  setup do
    @product = products(:one)
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:products)
  end

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

  test "should create product" do
    assert_difference('Product.count') do
      post :create, product: @product.attributes
    end

    assert_redirected_to product_path(assigns(:product))
  end

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

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

  test "should update product" do
    put :update, id: @product.to_param, product: @product.attributes
    assert_redirected_to product_path(assigns(:product))
  end

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

    assert_redirected_to products_path
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dejavu-0.3.1 test_app/test/functional/products_controller_test.rb
dejavu-0.3.0 test_app/test/functional/products_controller_test.rb
dejavu-0.2.1 test_app/test/functional/products_controller_test.rb
dejavu-0.2.0 test_app/test/functional/products_controller_test.rb
dejavu-0.1.2 test_app/test/functional/products_controller_test.rb
dejavu-0.1.1 test_app/test/functional/products_controller_test.rb
dejavu-0.1.0 test_app/test/functional/products_controller_test.rb