aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2022-10-07 21:48:38 +1300
committerGitHub <noreply@github.com>2022-10-07 21:48:38 +1300
commite4f91bbdbaa6ab3125f24967414ac5300bb244f5 (patch)
tree575f8febdd50601522c5e5ec72f3436139304537 /spec
parente76217a7f3957c9cea52832c2f4237130411f7dd (diff)
downloadruby-e4f91bbdbaa6ab3125f24967414ac5300bb244f5.tar.gz
Add IO#timeout attribute and use it for blocking IO operations. (#5653)
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/library/socket/tcpsocket/shared/new.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/ruby/library/socket/tcpsocket/shared/new.rb b/spec/ruby/library/socket/tcpsocket/shared/new.rb
index 4189acc2f8..e7eb2f3c13 100644
--- a/spec/ruby/library/socket/tcpsocket/shared/new.rb
+++ b/spec/ruby/library/socket/tcpsocket/shared/new.rb
@@ -14,7 +14,7 @@ describe :tcpsocket_new, shared: true do
}
end
- ruby_version_is "3.0" do
+ ruby_version_is "3.0"..."3.1" do
it 'raises Errno::ETIMEDOUT with :connect_timeout when no server is listening on the given address' do
-> {
TCPSocket.send(@method, "192.0.2.1", 80, connect_timeout: 0)
@@ -22,6 +22,14 @@ describe :tcpsocket_new, shared: true do
end
end
+ ruby_version_is "3.2" do
+ it 'raises IO::TimeoutError with :connect_timeout when no server is listening on the given address' do
+ -> {
+ TCPSocket.send(@method, "192.0.2.1", 80, connect_timeout: 0)
+ }.should raise_error(IO::TimeoutError)
+ end
+ end
+
describe "with a running server" do
before :each do
@server = SocketSpecs::SpecTCPServer.new