summaryrefslogtreecommitdiffstats
path: root/vendor/gems/net-ldap-0.2.2/spec/unit/ldap_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gems/net-ldap-0.2.2/spec/unit/ldap_spec.rb')
-rw-r--r--vendor/gems/net-ldap-0.2.2/spec/unit/ldap_spec.rb48
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/gems/net-ldap-0.2.2/spec/unit/ldap_spec.rb b/vendor/gems/net-ldap-0.2.2/spec/unit/ldap_spec.rb
new file mode 100644
index 000000000..1edb5c9a7
--- /dev/null
+++ b/vendor/gems/net-ldap-0.2.2/spec/unit/ldap_spec.rb
@@ -0,0 +1,48 @@
+require 'spec_helper'
+
+describe Net::LDAP::Connection do
+ describe "initialize" do
+ context "when host is not responding" do
+ before(:each) do
+ flexmock(TCPSocket).
+ should_receive(:new).and_raise(Errno::ECONNREFUSED)
+ end
+
+ it "should raise LdapError" do
+ lambda {
+ Net::LDAP::Connection.new(
+ :server => 'test.mocked.com',
+ :port => 636)
+ }.should raise_error(Net::LDAP::LdapError)
+ end
+ end
+ context "when host is blocking the port" do
+ before(:each) do
+ flexmock(TCPSocket).
+ should_receive(:new).and_raise(SocketError)
+ end
+
+ it "should raise LdapError" do
+ lambda {
+ Net::LDAP::Connection.new(
+ :server => 'test.mocked.com',
+ :port => 636)
+ }.should raise_error(Net::LDAP::LdapError)
+ end
+ end
+ context "on other exceptions" do
+ before(:each) do
+ flexmock(TCPSocket).
+ should_receive(:new).and_raise(NameError)
+ end
+
+ it "should rethrow the exception" do
+ lambda {
+ Net::LDAP::Connection.new(
+ :server => 'test.mocked.com',
+ :port => 636)
+ }.should raise_error(NameError)
+ end
+ end
+ end
+end \ No newline at end of file