lib/github/ldap/server.rb in github-ldap-1.0.2 vs lib/github/ldap/server.rb in github-ldap-1.0.3

- old
+ new

@@ -36,17 +36,33 @@ @ldap_server ||= Ladle::Server.new( allow_anonymous: false, ldif: server_options[:user_fixtures], domain: server_options[:user_domain], port: server_options[:port], - quiet: server_options[:quiet]) + quiet: server_options[:quiet], + tmpdir: server_tmp) @ldap_server.start end # Stop the testing server. # If there is no server started this method doesn't do anything. def self.stop_server ldap_server && ldap_server.stop + end + + # Determine the temporal directory where the ldap server lives. + # If there is no temporal directory in the environment we create one in the base path. + # + # Returns the path to the temporal directory. + def self.server_tmp + tmp = ENV['TMPDIR'] || ENV['TEMPDIR'] + + if tmp.nil? + tmp = 'tmp' + Dir.mkdir(tmp) + end + + tmp end end end