File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
require_relative 'test_helper'
2
2
3
3
class TestLDAPConnection < Test ::Unit ::TestCase
4
+ def capture_stderr
5
+ stderr , $stderr = $stderr, StringIO . new
6
+ yield
7
+ $stderr. string
8
+ ensure
9
+ $stderr = stderr
10
+ end
11
+
4
12
def test_unresponsive_host
5
13
assert_raise Net ::LDAP ::Error do
6
14
Net ::LDAP ::Connection . new ( :host => 'test.mocked.com' , :port => 636 )
@@ -16,9 +24,12 @@ def test_blocked_port
16
24
17
25
def test_connection_refused
18
26
flexmock ( TCPSocket ) . should_receive ( :new ) . and_raise ( Errno ::ECONNREFUSED )
19
- assert_raise Net ::LDAP ::ConnectionRefusedError do
20
- Net ::LDAP ::Connection . new ( :host => 'test.mocked.com' , :port => 636 )
27
+ stderr = capture_stderr do
28
+ assert_raise Net ::LDAP ::ConnectionRefusedError do
29
+ Net ::LDAP ::Connection . new ( :host => 'test.mocked.com' , :port => 636 )
30
+ end
21
31
end
32
+ assert_equal ( "Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead.\n " , stderr )
22
33
end
23
34
24
35
def test_raises_unknown_exceptions
You can’t perform that action at this time.
0 commit comments