@@ -119,6 +119,11 class AccountControllerTest < ActionController::TestCase | |||||
119 | assert_equal 2, @request.session[:user_id] |
|
119 | assert_equal 2, @request.session[:user_id] | |
120 | end |
|
120 | end | |
121 |
|
121 | |||
|
122 | def test_get_logout_with_anonymous_should_redirect | |||
|
123 | get :logout | |||
|
124 | assert_redirected_to '/' | |||
|
125 | end | |||
|
126 | ||||
122 | def test_logout |
|
127 | def test_logout | |
123 | @request.session[:user_id] = 2 |
|
128 | @request.session[:user_id] = 2 | |
124 | post :logout |
|
129 | post :logout | |
@@ -251,6 +256,15 class AccountControllerTest < ActionController::TestCase | |||||
251 | end |
|
256 | end | |
252 | end |
|
257 | end | |
253 |
|
258 | |||
|
259 | def test_lost_password_for_user_who_cannot_change_password_should_fail | |||
|
260 | User.any_instance.stubs(:change_password_allowed?).returns(false) | |||
|
261 | ||||
|
262 | assert_no_difference 'Token.count' do | |||
|
263 | post :lost_password, :mail => 'JSmith@somenet.foo' | |||
|
264 | assert_response :success | |||
|
265 | end | |||
|
266 | end | |||
|
267 | ||||
254 | def test_get_lost_password_with_token_should_display_the_password_recovery_form |
|
268 | def test_get_lost_password_with_token_should_display_the_password_recovery_form | |
255 | user = User.find(2) |
|
269 | user = User.find(2) | |
256 | token = Token.create!(:action => 'recovery', :user => user) |
|
270 | token = Token.create!(:action => 'recovery', :user => user) | |
@@ -316,4 +330,15 class AccountControllerTest < ActionController::TestCase | |||||
316 | end |
|
330 | end | |
317 | end |
|
331 | end | |
318 | end |
|
332 | end | |
|
333 | ||||
|
334 | def test_activation_email_without_session_data_should_fail | |||
|
335 | User.find(2).update_attribute :status, User::STATUS_REGISTERED | |||
|
336 | ||||
|
337 | with_settings :self_registration => '1' do | |||
|
338 | assert_no_difference 'ActionMailer::Base.deliveries.size' do | |||
|
339 | get :activation_email | |||
|
340 | assert_redirected_to '/' | |||
|
341 | end | |||
|
342 | end | |||
|
343 | end | |||
319 | end |
|
344 | end |
General Comments 0
You need to be logged in to leave comments.
Login now