summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest/ldap.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-06-24 07:06:56 +0100
committerSteve Kemp <steve@steve.org.uk>2013-06-24 07:06:56 +0100
commit5ff8506229d679afac3a74c3323f38890d36ce62 (patch)
tree2e1e527add69097ff94edd412d94acbc99b6e155 /lib/custodian/protocoltest/ldap.rb
parent48b454593a342e16a1e64849ea69b4f57f8afb5d (diff)
Allow the code to load when the ruby LDAP module is not present.
Although the actual protocol-test will instafail this allows the test suite to be executed without the LDAP library being present.
Diffstat (limited to 'lib/custodian/protocoltest/ldap.rb')
-rw-r--r--lib/custodian/protocoltest/ldap.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/custodian/protocoltest/ldap.rb b/lib/custodian/protocoltest/ldap.rb
index dfe1cc8..53257a0 100644
--- a/lib/custodian/protocoltest/ldap.rb
+++ b/lib/custodian/protocoltest/ldap.rb
@@ -1,5 +1,4 @@
-require 'ldap'
#
# The LDAP-protocol test.
@@ -75,7 +74,6 @@ module Custodian
-
#
# Allow this test to be serialized.
#
@@ -91,6 +89,13 @@ module Custodian
#
def run_test
+ begin
+ require 'ldap'
+ rescue LoadError
+ @error = "LDAP library not available - test disabled"
+ return false
+ end
+
# reset the error, in case we were previously executed.
@error = nil
@@ -145,8 +150,6 @@ module Custodian
register_test_type "ldap"
-
-
+ end
end
end
-end