Sha256: 2c65b54ac774ce4db54a03ec259045b9df80dc5c35ab10376ae4c3aeff8b654c

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'
require 'users_controller'

# Re-raise errors caught by the controller.
class UsersController; def rescue_action(e) raise e end; end

class UsersControllerTest < Test::Unit::TestCase
  fixtures :users

  def setup
    @controller = UsersController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end

  def test_should_get_index
    get :index
    assert_response :success
    assert assigns(:users)
  end

  def test_should_get_new
    get :new
    assert_response :success
  end

  def test_should_create_user
    assert_difference('User.count') do
      post :create, :user => { }
    end

    assert_redirected_to user_path(assigns(:user))
  end

  def test_should_show_user
    get :show, :id => 1
    assert_response :success
  end

  def test_should_get_edit
    get :edit, :id => 1
    assert_response :success
  end

  def test_should_update_user
    put :update, :id => 1, :user => { }
    assert_redirected_to user_path(assigns(:user))
  end

  def test_should_destroy_user
    new_user = User.new(:login => 'test', :email => 'test@test.com')
    
    assert_difference('User.count', +1) do
      new_user.save
    end

    assert_difference('User.count', -1) do
      delete :destroy, :id => new_user.id
    end
    assert_redirected_to users_path
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ultrasphinx-1.11 test/integration/app/test/functional/users_controller_test.rb