##// END OF EJS Templates
Additional tests for AccountController....
Jean-Philippe Lang -
r11792:085417bdbb34
parent child
Show More
@@ -119,6 +119,11 class AccountControllerTest < ActionController::TestCase
119 119 assert_equal 2, @request.session[:user_id]
120 120 end
121 121
122 def test_get_logout_with_anonymous_should_redirect
123 get :logout
124 assert_redirected_to '/'
125 end
126
122 127 def test_logout
123 128 @request.session[:user_id] = 2
124 129 post :logout
@@ -251,6 +256,15 class AccountControllerTest < ActionController::TestCase
251 256 end
252 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 268 def test_get_lost_password_with_token_should_display_the_password_recovery_form
255 269 user = User.find(2)
256 270 token = Token.create!(:action => 'recovery', :user => user)
@@ -316,4 +330,15 class AccountControllerTest < ActionController::TestCase
316 330 end
317 331 end
318 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 344 end
General Comments 0
You need to be logged in to leave comments. Login now