summaryrefslogtreecommitdiffstats
path: root/test/functional/account_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-07-14 14:39:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-07-14 14:39:31 +0000
commit085417bdbb340718cd7213f53d56084ef954c3a8 (patch)
treefb97e0cec1041761669d6fff2c06f81cd015169d /test/functional/account_controller_test.rb
parent205eda8b33d69defecedf2d246858a46d3d1d7c0 (diff)
downloadredmine-085417bdbb340718cd7213f53d56084ef954c3a8.tar.gz
redmine-085417bdbb340718cd7213f53d56084ef954c3a8.zip
Additional tests for AccountController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12022 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/account_controller_test.rb')
-rw-r--r--test/functional/account_controller_test.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index b54a306d5..0aae7b596 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -119,6 +119,11 @@ class AccountControllerTest < ActionController::TestCase
assert_equal 2, @request.session[:user_id]
end
+ def test_get_logout_with_anonymous_should_redirect
+ get :logout
+ assert_redirected_to '/'
+ end
+
def test_logout
@request.session[:user_id] = 2
post :logout
@@ -251,6 +256,15 @@ class AccountControllerTest < ActionController::TestCase
end
end
+ def test_lost_password_for_user_who_cannot_change_password_should_fail
+ User.any_instance.stubs(:change_password_allowed?).returns(false)
+
+ assert_no_difference 'Token.count' do
+ post :lost_password, :mail => 'JSmith@somenet.foo'
+ assert_response :success
+ end
+ end
+
def test_get_lost_password_with_token_should_display_the_password_recovery_form
user = User.find(2)
token = Token.create!(:action => 'recovery', :user => user)
@@ -316,4 +330,15 @@ class AccountControllerTest < ActionController::TestCase
end
end
end
+
+ def test_activation_email_without_session_data_should_fail
+ User.find(2).update_attribute :status, User::STATUS_REGISTERED
+
+ with_settings :self_registration => '1' do
+ assert_no_difference 'ActionMailer::Base.deliveries.size' do
+ get :activation_email
+ assert_redirected_to '/'
+ end
+ end
+ end
end