From a8e392c0e5732e934b6e45a68a69e9e0170432c9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 11 Mar 2012 12:01:41 +0000 Subject: [PATCH] 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 --- app/models/auth_source_ldap.rb | 4 ++-- test/functional/auth_sources_controller_test.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb index bf8d70478..5b8dc0cfe 100644 --- a/app/models/auth_source_ldap.rb +++ b/app/models/auth_source_ldap.rb @@ -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 diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb index 96dcb5c78..ae197e227 100644 --- a/test/functional/auth_sources_controller_test.rb +++ b/test/functional/auth_sources_controller_test.rb @@ -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 -- 2.39.5