File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
spec/ruby/library/socket/tcpsocket/shared Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 19
19
-> {
20
20
TCPSocket . send ( @method , "192.0.2.1" , 80 , connect_timeout : 0 )
21
21
} . should raise_error ( Errno ::ETIMEDOUT )
22
+ rescue Errno ::ENETUNREACH
23
+ # In the case all network interfaces down.
24
+ # raise_error cannot deal with multiple expected exceptions
22
25
end
23
26
end
24
27
27
30
-> {
28
31
TCPSocket . send ( @method , "192.0.2.1" , 80 , connect_timeout : 0 )
29
32
} . should raise_error ( IO ::TimeoutError )
33
+ rescue Errno ::ENETUNREACH
34
+ # In the case all network interfaces down.
35
+ # raise_error cannot deal with multiple expected exceptions
30
36
end
31
37
end
32
38
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ def test_initialize_resolv_timeout
70
70
end
71
71
72
72
def test_initialize_connect_timeout
73
- assert_raise ( IO ::TimeoutError ) do
73
+ assert_raise ( IO ::TimeoutError , Errno :: ENETUNREACH ) do
74
74
TCPSocket . new ( "192.0.2.1" , 80 , connect_timeout : 0 )
75
75
end
76
76
end
You can’t perform that action at this time.
0 commit comments