Class: UsersControllerTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- UsersControllerTest
- Includes:
- AuthenticatedTestHelper
- Defined in:
- vendor/plugins/authentication/test/functional/users_controller_test.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_should_activate_user ⇒ Object
- #test_should_allow_signup ⇒ Object
- #test_should_not_activate_user_with_blank_key ⇒ Object
- #test_should_not_activate_user_without_key ⇒ Object
- #test_should_require_email_on_signup ⇒ Object
- #test_should_require_login_on_signup ⇒ Object
- #test_should_require_password_confirmation_on_signup ⇒ Object
- #test_should_require_password_on_signup ⇒ Object
- #test_should_sign_up_user_in_pending_state ⇒ Object
- #test_should_sign_up_user_with_activation_code ⇒ Object
Methods included from AuthenticatedTestHelper
Instance Method Details
#setup ⇒ Object
14 15 16 17 18 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 14 def setup @controller = UsersController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end |
#test_should_activate_user ⇒ Object
72 73 74 75 76 77 78 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 72 def test_should_activate_user assert_nil User.authenticate('aaron', 'test') get :activate, :activation_code => users(:aaron).activation_code assert_redirected_to '/' assert_not_nil flash[:notice] assert_equal users(:aaron), User.authenticate('aaron', 'test') end |
#test_should_allow_signup ⇒ Object
20 21 22 23 24 25 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 20 def test_should_allow_signup assert_difference 'User.count' do create_user assert_response :redirect end end |
#test_should_not_activate_user_with_blank_key ⇒ Object
87 88 89 90 91 92 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 87 def test_should_not_activate_user_with_blank_key get :activate, :activation_code => '' assert_nil flash[:notice] rescue ActionController::RoutingError # well played, sir end |
#test_should_not_activate_user_without_key ⇒ Object
80 81 82 83 84 85 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 80 def test_should_not_activate_user_without_key get :activate assert_nil flash[:notice] rescue ActionController::RoutingError # in the event your routes deny this, we'll just bow out gracefully. end |
#test_should_require_email_on_signup ⇒ Object
51 52 53 54 55 56 57 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 51 def test_should_require_email_on_signup assert_no_difference 'User.count' do create_user(:email => nil) assert assigns(:user).errors.on(:email) assert_response :success end end |
#test_should_require_login_on_signup ⇒ Object
27 28 29 30 31 32 33 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 27 def test_should_require_login_on_signup assert_no_difference 'User.count' do create_user(:login => nil) assert assigns(:user).errors.on(:login) assert_response :success end end |
#test_should_require_password_confirmation_on_signup ⇒ Object
43 44 45 46 47 48 49 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 43 def test_should_require_password_confirmation_on_signup assert_no_difference 'User.count' do create_user(:password_confirmation => nil) assert assigns(:user).errors.on(:password_confirmation) assert_response :success end end |
#test_should_require_password_on_signup ⇒ Object
35 36 37 38 39 40 41 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 35 def test_should_require_password_on_signup assert_no_difference 'User.count' do create_user(:password => nil) assert assigns(:user).errors.on(:password) assert_response :success end end |
#test_should_sign_up_user_in_pending_state ⇒ Object
59 60 61 62 63 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 59 def test_should_sign_up_user_in_pending_state create_user assigns(:user).reload assert assigns(:user).pending? end |
#test_should_sign_up_user_with_activation_code ⇒ Object
66 67 68 69 70 |
# File 'vendor/plugins/authentication/test/functional/users_controller_test.rb', line 66 def test_should_sign_up_user_with_activation_code create_user assigns(:user).reload assert_not_nil assigns(:user).activation_code end |