diff --git a/library/socket/tcpsocket/shared/new.rb b/library/socket/tcpsocket/shared/new.rb index 30e963b12a..4189acc2f8 100644 --- a/library/socket/tcpsocket/shared/new.rb +++ b/library/socket/tcpsocket/shared/new.rb @@ -14,10 +14,12 @@ } end - 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) - }.should raise_error(Errno::ETIMEDOUT) + ruby_version_is "3.0" 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) + }.should raise_error(Errno::ETIMEDOUT) + end end describe "with a running server" do