Sha256: a3982277e8c7bd41ba58ed0fc031d4d163abc4f5cf4b6c75d46c4e77976323bc

Contents?: true

Size: 912 Bytes

Versions: 2

Compression:

Stored size: 912 Bytes

Contents

require 'test_helper'

class UsersControllerTest < ActionController::TestCase
  # setup do
  #   @user = users(:one)
  # end

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

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

  test "should create user" do
    assert_difference('User.count') do
      post :create, user: {name: 'Joe Smith'}
    end

    assert_redirected_to users_path
  end

  test "should update user" do
    user = User.new(name: "Joe Smith").save
    patch :update, id: user, user: { name: "Smith Joe" }
    assert_redirected_to users_paths
  end

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

  test "should destroy post" do
    user = User.new(name: "Joe Smith").save

    assert_difference('User.count', -1) do
      delete :destroy, id: user
    end

    assert_redirected_to users_path
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_crud-0.1.1 test/dummy/test/controllers/users_controller_test.rb
simple_crud-0.1.0 test/dummy/test/controllers/users_controller_test.rb