Skip to content

Commit ead2469

Browse files
author
Jerry Cheung
committed
Merge remote-tracking branch 'jch/minitestify' into minitestify
2 parents 36005eb + 1ac9d61 commit ead2469

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ language: ruby
22
rvm:
33
- 1.9.3
44
- 2.0.0
5+
- 2.1.2
56
- jruby-19mode
67
- rbx-19mode
8+
# - rbx-2
79
matrix:
810
allow_failures:
911
- rvm: jruby-19mode
10-
script: bundle exec rake spec
12+
script: bundle exec rake

Manifest.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ lib/net/ldap/version.rb
2929
lib/net/snmp.rb
3030
net-ldap.gemspec
3131
spec/integration/ssl_ber_spec.rb
32-
spec/spec.opts
3332
spec/spec_helper.rb
3433
spec/unit/ber/ber_spec.rb
3534
spec/unit/ber/core_ext/array_spec.rb

lib/net/ldap/connection.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ def initialize(server)
1515
raise Net::LDAP::LdapError, "No such address or other socket error."
1616
rescue Errno::ECONNREFUSED
1717
raise Net::LDAP::LdapError, "Server #{server[:host]} refused connection on port #{server[:port]}."
18+
rescue Errno::EHOSTUNREACH => error
19+
raise Net::LDAP::LdapError, "Host #{server[:host]} was unreachable (#{error.message})"
1820
end
1921

2022
if server[:encryption]

test/test_ldap.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'common'
1+
require 'test_helper'
22

33
class TestLDAPInstrumentation < Test::Unit::TestCase
44
def setup
@@ -7,7 +7,7 @@ def setup
77

88
@service = MockInstrumentationService.new
99
@subject = Net::LDAP.new \
10-
:server => "test.mocked.com", :port => 636,
10+
:host => "test.mocked.com", :port => 636,
1111
:force_no_page => true, # so server capabilities are not queried
1212
:instrumentation_service => @service
1313
end

test/test_ldap_connection.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
class TestLDAPConnection < Test::Unit::TestCase
44
def test_unresponsive_host
55
assert_raise Net::LDAP::LdapError do
6-
Net::LDAP::Connection.new(:server => 'test.mocked.com', :port => 636)
6+
Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
77
end
88
end
99

1010
def test_blocked_port
1111
flexmock(TCPSocket).should_receive(:new).and_raise(SocketError)
1212
assert_raise Net::LDAP::LdapError do
13-
Net::LDAP::Connection.new(:server => 'test.mocked.com', :port => 636)
13+
Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
1414
end
1515
end
1616

1717
def test_raises_unknown_exceptions
1818
error = Class.new(StandardError)
1919
flexmock(TCPSocket).should_receive(:new).and_raise(error)
2020
assert_raise error do
21-
Net::LDAP::Connection.new(:server => 'test.mocked.com', :port => 636)
21+
Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
2222
end
2323
end
2424

@@ -50,7 +50,7 @@ def setup
5050
@tcp_socket = flexmock(:connection)
5151
@tcp_socket.should_receive(:write)
5252
flexmock(TCPSocket).should_receive(:new).and_return(@tcp_socket)
53-
@connection = Net::LDAP::Connection.new(:server => 'test.mocked.com', :port => 636)
53+
@connection = Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
5454
end
5555

5656
def test_error_failed_operation
@@ -74,15 +74,15 @@ def test_no_error_on_success
7474
end
7575
end
7676

77-
class TestLDAPInstrumentation < Test::Unit::TestCase
77+
class TestLDAPConnectionInstrumentation < Test::Unit::TestCase
7878
def setup
7979
@tcp_socket = flexmock(:connection)
8080
@tcp_socket.should_receive(:write)
8181
flexmock(TCPSocket).should_receive(:new).and_return(@tcp_socket)
8282

8383
@service = MockInstrumentationService.new
8484
@connection = Net::LDAP::Connection.new \
85-
:server => 'test.mocked.com',
85+
:host => 'test.mocked.com',
8686
:port => 636,
8787
:instrumentation_service => @service
8888
end

0 commit comments

Comments
 (0)