Sha256: 25134f5d54d9aa42a42d54bae4b08fae6fc9bc5a56df4cc7ccd0a907b0aeb22d

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'test_helper'

class ThingsControllerTest < ActionController::TestCase
  setup do
    @thing = things(:one)
  end

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

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

  test "should create thing" do
    assert_difference('Thing.count') do
      post :create, thing: { name: @thing.name, price: @thing.price, qty: @thing.qty }
    end

    assert_redirected_to thing_path(assigns(:thing))
  end

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

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

  test "should update thing" do
    patch :update, id: @thing, thing: { name: @thing.name, price: @thing.price, qty: @thing.qty }
    assert_redirected_to thing_path(assigns(:thing))
  end

  test "should destroy thing" do
    assert_difference('Thing.count', -1) do
      delete :destroy, id: @thing
    end

    assert_redirected_to things_path
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_cart-0.0.5 spec/dummy/test/controllers/things_controller_test.rb
simple_cart-0.0.4 spec/dummy/test/controllers/things_controller_test.rb
simple_cart-0.0.3 test/dummy/test/controllers/things_controller_test.rb