Sha256: c07f0992d79a2bd33aee7f4eff6a086a47211c9e44f3025fc509207ad65eaff7

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require 'test_helper'

class BicyclesControllerTest < ActionController::TestCase
  setup do
    @bicycle = bicycles(:one)
  end

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

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

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

    assert_redirected_to bicycle_path(assigns(:bicycle))
  end

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

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

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

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

    assert_redirected_to bicycles_path
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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