Add the has_many_polymorphs plugin
[cs356-p2-videostore.git] / vendor / plugins / has_many_polymorphs / test / integration / app / test / functional / users_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'users_controller'
3
4 # Re-raise errors caught by the controller.
5 class UsersController; def rescue_action(e) raise e end; end
6
7 class UsersControllerTest < Test::Unit::TestCase
8   fixtures :users
9
10   def setup
11     @controller = UsersController.new
12     @request    = ActionController::TestRequest.new
13     @response   = ActionController::TestResponse.new
14   end
15
16   def test_should_get_index
17     get :index
18     assert_response :success
19     assert assigns(:users)
20   end
21
22   def test_should_get_new
23     get :new
24     assert_response :success
25   end
26
27   def test_should_create_user
28     assert_difference('User.count') do
29       post :create, :user => { }
30     end
31
32     assert_redirected_to user_path(assigns(:user))
33   end
34
35   def test_should_show_user
36     get :show, :id => 1
37     assert_response :success
38   end
39
40   def test_should_get_edit
41     get :edit, :id => 1
42     assert_response :success
43   end
44
45   def test_should_update_user
46     put :update, :id => 1, :user => { }
47     assert_redirected_to user_path(assigns(:user))
48   end
49
50   def test_should_destroy_user
51     assert_difference('User.count', -1) do
52       delete :destroy, :id => 1
53     end
54
55     assert_redirected_to users_path
56   end
57 end