Commits

Michael Granger committed bc0fbbd

Add Connection#inspect

Comments (0)

Files changed (3)

 	### Shortcut connection method: return a OpenLDAP::Connection object that will use
 	### the specified +urls+ (or )
 	def self::connect( *urls )
-		
+		return OpenLDAP::Connection.new( *urls )
 	end
 
 end # module OpenLDAP

lib/openldap/connection.rb

 
 	### Return a String representation of the object suitable for debugging.
 	def inspect
-		return "#<%p:%#016x %s>"
+		return "#<%p:%#016x %s>" % [
+			self.class,
+			self.object_id * 2,
+			self.uris.map( &:to_s ).join(', '),
+		]
 	end
 
 

spec/openldap/connection_spec.rb

 		conn.uris.should == [ TEST_LDAP_URI, TEST_LDAPS_URI ]
 	end
 
-	context "instances" do
+	context "instance connected to #{TEST_LDAP_URI}" do
 
 		before( :each ) do
 			@conn = OpenLDAP::Connection.new( TEST_LDAP_URI )
 		end
 
+		it "includes its URL in its inspect output" do
+			@conn.inspect.should include( TEST_LDAP_STRING )
+		end
+
 		it "can set the cacert file used for TLS" do
 			@conn.tls_cacertfile = Pathname( '/etc/openssl/cacerts/ldap.pem' )
 			@conn.tls_cacertfile.should == '/etc/openssl/cacerts/ldap.pem'