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 11require_relative 'test_helper'
22
33class 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+
412 def test_unresponsive_host
513 assert_raise Net ::LDAP ::Error do
614 Net ::LDAP ::Connection . new ( :host => 'test.mocked.com' , :port => 636 )
@@ -16,9 +24,12 @@ def test_blocked_port
1624
1725 def test_connection_refused
1826 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
2131 end
32+ assert_equal ( "Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead.\n " , stderr )
2233 end
2334
2435 def test_raises_unknown_exceptions
You can’t perform that action at this time.
0 commit comments