Sha256: 634596e78abf137690b4f7010ded4b9a819867a969a3e1015f21501d72167258

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require 'test_helper'

class UsersControllerTest < ActionController::TestCase
  test_data do
    puts "Loading test data in #{self}"    
    Factory.create(:user, :login => 'colszowka')
    8.times do
      Factory.create(:user)
    end
  end
  
  def setup
    @user = User.find_by_login!('colszowka')
  end
  
  test "should get index" do
    get :index
    assert_response :success
    assert_equal 9, assigns(:users).count
  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 => { }
    end

    assert_redirected_to user_path(assigns(:user))
  end

  test "should show user" do
    get :show, :id => @user.to_param
    assert_response :success
  end

  test "should get edit" do
    get :edit, :id => @user.to_param
    assert_response :success
  end

  test "should update user" do
    put :update, :id => @user.to_param, :user => { }
    assert_redirected_to user_path(assigns(:user))
  end

  test "should destroy user" do
    assert_difference('User.count', -1) do
      delete :destroy, :id => @user.to_param
    end

    assert_redirected_to users_path
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
transactionata-0.3.0 test/rails2/test/functional/users_controller_test.rb
transactionata-0.2.0 test/rails2/test/functional/users_controller_test.rb
transactionata-0.1.0 test/rails2/test/functional/users_controller_test.rb