Skip to content

Commit 22a5c3a

Browse files
committed
Fix :connect_timeout spec
* Using a similar approach to the CRuby test TestSocket_TCPSocket#test_initialize_connect_timeout
1 parent 079ad49 commit 22a5c3a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: library/socket/tcpsocket/initialize_spec.rb

+6-8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
it 'raises Errno::ECONNREFUSED' do
88
-> { TCPSocket.new(ip_address, 666) }.should raise_error(Errno::ECONNREFUSED)
99
end
10+
11+
it 'raises Errno::ETIMEDOUT with :connect_timeout' do
12+
-> {
13+
TCPSocket.new("192.0.2.1", 80, connect_timeout: 0)
14+
}.should raise_error(Errno::ETIMEDOUT)
15+
end
1016
end
1117

1218
describe 'when a server is listening on the given address' do
@@ -56,14 +62,6 @@
5662
@client.local_address.ip_port.should_not == @port
5763
end
5864
end
59-
60-
describe 'when server connection is timeout' do
61-
ruby_version_is "3.0" do
62-
it 'raises Errno::ETIMEDOUT' do
63-
-> { TCPSocket.new(ip_address, @port, connect_timeout: 0) }.should raise_error(Errno::ETIMEDOUT)
64-
end
65-
end
66-
end
6765
end
6866
end
6967
end

0 commit comments

Comments
 (0)