Adds a way for a registered user to get a new action email (#14228).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11946 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-06-09 10:01:56 +00:00
parent ec46d4315c
commit 4bd874ab46
7 changed files with 144 additions and 13 deletions
+43 -1
View File
@@ -63,6 +63,36 @@ class AccountControllerTest < ActionController::TestCase
assert_select 'input[name=password][value]', 0
end
def test_login_with_locked_account_should_fail
User.find(2).update_attribute :status, User::STATUS_LOCKED
post :login, :username => 'jsmith', :password => 'jsmith'
assert_redirected_to '/login'
assert_include 'locked', flash[:error]
assert_nil @request.session[:user_id]
end
def test_login_as_registered_user_with_manual_activation_should_inform_user
User.find(2).update_attribute :status, User::STATUS_REGISTERED
with_settings :self_registration => '2', :default_language => 'en' do
post :login, :username => 'jsmith', :password => 'jsmith'
assert_redirected_to '/login'
assert_include 'pending administrator approval', flash[:error]
end
end
def test_login_as_registered_user_with_email_activation_should_propose_new_activation_email
User.find(2).update_attribute :status, User::STATUS_REGISTERED
with_settings :self_registration => '1', :default_language => 'en' do
post :login, :username => 'jsmith', :password => 'jsmith'
assert_redirected_to '/login'
assert_equal 2, @request.session[:registered_user_id]
assert_include 'new activation email', flash[:error]
end
end
def test_login_should_rescue_auth_source_exception
source = AuthSource.create!(:name => 'Test')
User.find(2).update_attribute :auth_source_id, source.id
@@ -217,7 +247,7 @@ class AccountControllerTest < ActionController::TestCase
assert_no_difference 'Token.count' do
post :lost_password, :mail => 'JSmith@somenet.foo'
assert_response :success
assert_redirected_to '/account/lost_password'
end
end
@@ -274,4 +304,16 @@ class AccountControllerTest < ActionController::TestCase
post :lost_password, :token => "abcdef", :new_password => 'newpass', :new_password_confirmation => 'newpass'
assert_redirected_to '/'
end
def test_activation_email_should_send_an_activation_email
User.find(2).update_attribute :status, User::STATUS_REGISTERED
@request.session[:registered_user_id] = 2
with_settings :self_registration => '1' do
assert_difference 'ActionMailer::Base.deliveries.size' do
get :activation_email
assert_redirected_to '/login'
end
end
end
end