1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'users_controller'
4 # Re-raise errors caught by the controller.
5 class UsersController; def rescue_action(e) raise e end; end
7 class UsersControllerTest < Test::Unit::TestCase
11 @controller = UsersController.new
12 @request = ActionController::TestRequest.new
13 @response = ActionController::TestResponse.new
16 def test_should_get_index
18 assert_response :success
19 assert assigns(:users)
22 def test_should_get_new
24 assert_response :success
27 def test_should_create_user
28 assert_difference('User.count') do
29 post :create, :user => { }
32 assert_redirected_to user_path(assigns(:user))
35 def test_should_show_user
37 assert_response :success
40 def test_should_get_edit
42 assert_response :success
45 def test_should_update_user
46 put :update, :id => 1, :user => { }
47 assert_redirected_to user_path(assigns(:user))
50 def test_should_destroy_user
51 assert_difference('User.count', -1) do
52 delete :destroy, :id => 1
55 assert_redirected_to users_path