]> source.dussan.org Git - redmine.git/commitdiff
replace depricated Net::LDAP::LdapError by Net::LDAP::Error (#24970)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 2 Feb 2017 02:24:50 +0000 (02:24 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 2 Feb 2017 02:24:50 +0000 (02:24 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16322 e93f8b46-1217-0410-a6f0-8f06a7374b81

Gemfile
app/models/auth_source_ldap.rb
test/functional/auth_sources_controller_test.rb
test/unit/auth_source_ldap_test.rb
test/unit/user_test.rb

diff --git a/Gemfile b/Gemfile
index b539a769d8d5b441c1224b4ce1c36c70faba552c..57f6c072fe9852faf8c662ece6032a0bc96d0657 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -26,7 +26,7 @@ gem "rbpdf", "~> 1.19.0"
 
 # Optional gem for LDAP authentication
 group :ldap do
-  gem "net-ldap", "~> 0.12.0"
+  gem "net-ldap", "~> 0.12.1"
 end
 
 # Optional gem for OpenID authentication
index d2aa25212cc65d7f72a6cb7bf413b5b5f25c7d10..1301e326cb93c3881d18d0122c3ed46e15c0e7e1 100644 (file)
@@ -21,7 +21,7 @@ require 'timeout'
 
 class AuthSourceLdap < AuthSource
   NETWORK_EXCEPTIONS = [
-    Net::LDAP::LdapError,
+    Net::LDAP::Error,
     Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::ECONNRESET,
     Errno::EHOSTDOWN, Errno::EHOSTUNREACH,
     SocketError
@@ -117,7 +117,7 @@ class AuthSourceLdap < AuthSource
     if filter.present?
       Net::LDAP::Filter.construct(filter)
     end
-  rescue Net::LDAP::LdapError, Net::LDAP::FilterSyntaxInvalidError
+  rescue Net::LDAP::Error, Net::LDAP::FilterSyntaxInvalidError
     nil
   end
 
index 1ad829655c89975e7f1e535f2680fcafc6f96e40..f711ce15953cdc0164568f93eb593b97e5eece27 100644 (file)
@@ -134,7 +134,7 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
   end
 
   def test_test_connection_with_failure
-    AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError.new("Something went wrong"))
+    AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::Error.new("Something went wrong"))
 
     get :test_connection, :id => 1
     assert_redirected_to '/auth_sources'
index eac13ff70edc6127825cdd318295436cfa3f9c90..3ce7fa98ef1b785b27835dc181c526e5ad90f7ce 100644 (file)
@@ -150,7 +150,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
     end
 
     def test_search_with_exception_should_return_an_empty_array
-      Net::LDAP.stubs(:new).raises(Net::LDAP::LdapError, 'Cannot connect')
+      Net::LDAP.stubs(:new).raises(Net::LDAP::Error, 'Cannot connect')
 
       results = AuthSource.search("exa")
       assert_equal [], results
index ebc7d6532c3b49ee931b612735b780959ea02e14..3b42a7dec6255142480edee74a6e99f0fddd1b5f 100644 (file)
@@ -643,7 +643,7 @@ class UserTest < ActiveSupport::TestCase
   if ldap_configured?
     test "#try_to_login using LDAP with failed connection to the LDAP server" do
       auth_source = AuthSourceLdap.find(1)
-      AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError, 'Cannot connect')
+      AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::Error, 'Cannot connect')
 
       assert_nil User.try_to_login('edavis', 'wrong')
     end