Fixed that LDAP error is not displayed when testing connection.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9234 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-03-11 12:01:41 +00:00
parent 71e636ff71
commit a8e392c0e5
2 changed files with 4 additions and 4 deletions

View File

@ -49,8 +49,8 @@ class AuthSourceLdap < AuthSource
def test_connection
ldap_con = initialize_ldap_con(self.account, self.account_password)
ldap_con.open { }
rescue Net::LDAP::LdapError => text
raise "LdapError: " + text
rescue Net::LDAP::LdapError => e
raise "LdapError: " + e.message
end
def auth_method_name

View File

@ -117,11 +117,11 @@ class AuthSourcesControllerTest < ActionController::TestCase
end
def test_test_connection_with_failure
AuthSourceLdap.any_instance.stubs(:test_connection).raises(Exception.new("Something went wrong"))
AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError.new("Something went wrong"))
get :test_connection, :id => 1
assert_redirected_to '/auth_sources'
assert_not_nil flash[:error]
assert_include '(Something went wrong)', flash[:error]
assert_include 'Something went wrong', flash[:error]
end
end