summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest
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
commite2863db7243787e7afda894be43b64eb834b3291 (patch)
tree1c9cdb56e4a7af8360cbd9870e703abad2481459 /lib/custodian/protocoltest
parent848512cec70480caf3b6650c2bafa7fa42325552 (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')
-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