Sha256: dead4800474fd3b1aeb376722774c9cb6b759eb58e658fde56ac9bdef9183e89

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 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
  
  setup do
    @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 => @user.attributes
    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 => @user.attributes
    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/rails3/test/functional/users_controller_test.rb
transactionata-0.2.0 test/rails3/test/functional/users_controller_test.rb
transactionata-0.1.0 test/rails3/test/functional/users_controller_test.rb