summaryrefslogtreecommitdiff
path: root/spec/ruby/library/socket
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
commit5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch)
tree05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/library/socket
parenta06301b103371b0b7da8eaca26ba744961769f99 (diff)
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/library/socket')
-rw-r--r--spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/initialize_spec.rb16
-rw-r--r--spec/ruby/library/socket/addrinfo/ip_address_spec.rb2
-rw-r--r--spec/ruby/library/socket/addrinfo/ip_port_spec.rb2
-rw-r--r--spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb2
-rw-r--r--spec/ruby/library/socket/addrinfo/unix_path_spec.rb4
-rw-r--r--spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb2
-rw-r--r--spec/ruby/library/socket/ancillarydata/initialize_spec.rb34
-rw-r--r--spec/ruby/library/socket/ancillarydata/int_spec.rb2
-rw-r--r--spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb4
-rw-r--r--spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb2
-rw-r--r--spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/close_read_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/close_write_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/connect_address_spec.rb4
-rw-r--r--spec/ruby/library/socket/basicsocket/getpeereid_spec.rb2
-rw-r--r--spec/ruby/library/socket/basicsocket/getpeername_spec.rb2
-rw-r--r--spec/ruby/library/socket/basicsocket/getsockopt_spec.rb4
-rw-r--r--spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/recv_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb10
-rw-r--r--spec/ruby/library/socket/basicsocket/recvmsg_spec.rb10
-rw-r--r--spec/ruby/library/socket/basicsocket/send_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/sendmsg_spec.rb6
-rw-r--r--spec/ruby/library/socket/basicsocket/setsockopt_spec.rb30
-rw-r--r--spec/ruby/library/socket/basicsocket/shutdown_spec.rb24
-rw-r--r--spec/ruby/library/socket/ipsocket/addr_spec.rb2
-rw-r--r--spec/ruby/library/socket/ipsocket/getaddress_spec.rb2
-rw-r--r--spec/ruby/library/socket/ipsocket/peeraddr_spec.rb4
-rw-r--r--spec/ruby/library/socket/option/bool_spec.rb2
-rw-r--r--spec/ruby/library/socket/option/initialize_spec.rb12
-rw-r--r--spec/ruby/library/socket/option/int_spec.rb2
-rw-r--r--spec/ruby/library/socket/option/linger_spec.rb8
-rw-r--r--spec/ruby/library/socket/option/new_spec.rb6
-rw-r--r--spec/ruby/library/socket/shared/pack_sockaddr.rb2
-rw-r--r--spec/ruby/library/socket/shared/socketpair.rb14
-rw-r--r--spec/ruby/library/socket/socket/accept_loop_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/accept_nonblock_spec.rb10
-rw-r--r--spec/ruby/library/socket/socket/accept_spec.rb7
-rw-r--r--spec/ruby/library/socket/socket/bind_spec.rb22
-rw-r--r--spec/ruby/library/socket/socket/connect_nonblock_spec.rb10
-rw-r--r--spec/ruby/library/socket/socket/connect_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/gethostbyaddr_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/getnameinfo_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/getservbyname_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/getservbyport_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/initialize_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/listen_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/recvfrom_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/sysaccept_spec.rb6
-rw-r--r--spec/ruby/library/socket/socket/tcp_server_loop_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/tcp_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/udp_server_loop_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/unix_server_loop_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb4
-rw-r--r--spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb8
-rw-r--r--spec/ruby/library/socket/tcpserver/accept_spec.rb4
-rw-r--r--spec/ruby/library/socket/tcpserver/gets_spec.rb2
-rw-r--r--spec/ruby/library/socket/tcpserver/initialize_spec.rb2
-rw-r--r--spec/ruby/library/socket/tcpserver/listen_spec.rb2
-rw-r--r--spec/ruby/library/socket/tcpserver/new_spec.rb8
-rw-r--r--spec/ruby/library/socket/tcpserver/sysaccept_spec.rb4
-rw-r--r--spec/ruby/library/socket/tcpsocket/initialize_spec.rb4
-rw-r--r--spec/ruby/library/socket/tcpsocket/shared/new.rb4
-rw-r--r--spec/ruby/library/socket/udpsocket/bind_spec.rb2
-rw-r--r--spec/ruby/library/socket/udpsocket/new_spec.rb2
-rw-r--r--spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb4
-rw-r--r--spec/ruby/library/socket/udpsocket/send_spec.rb8
-rw-r--r--spec/ruby/library/socket/udpsocket/write_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixserver/accept_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixserver/initialize_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixserver/sysaccept_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixsocket/initialize_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixsocket/peeraddr_spec.rb2
79 files changed, 224 insertions, 227 deletions
diff --git a/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb b/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb
index d3419daaaf..2bc3b6a2e3 100644
--- a/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb
@@ -4,7 +4,7 @@ describe 'Addrinfo#family_addrinfo' do
it 'raises ArgumentError if no arguments are given' do
addr = Addrinfo.tcp('127.0.0.1', 0)
- lambda { addr.family_addrinfo }.should raise_error(ArgumentError)
+ -> { addr.family_addrinfo }.should raise_error(ArgumentError)
end
describe 'using multiple arguments' do
@@ -14,11 +14,11 @@ describe 'Addrinfo#family_addrinfo' do
end
it 'raises ArgumentError if only 1 argument is given' do
- lambda { @source.family_addrinfo('127.0.0.1') }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo('127.0.0.1') }.should raise_error(ArgumentError)
end
it 'raises ArgumentError if more than 2 arguments are given' do
- lambda { @source.family_addrinfo('127.0.0.1', 0, 666) }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo('127.0.0.1', 0, 666) }.should raise_error(ArgumentError)
end
it 'returns an Addrinfo when a host and port are given' do
@@ -57,7 +57,7 @@ describe 'Addrinfo#family_addrinfo' do
end
it 'raises ArgumentError if more than 1 argument is given' do
- lambda { @source.family_addrinfo('foo', 'bar') }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo('foo', 'bar') }.should raise_error(ArgumentError)
end
it 'returns an Addrinfo when a UNIX socket path is given' do
@@ -99,17 +99,17 @@ describe 'Addrinfo#family_addrinfo' do
it 'raises ArgumentError if more than 1 argument is given' do
input = Addrinfo.tcp('127.0.0.2', 0)
- lambda { @source.family_addrinfo(input, 666) }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo(input, 666) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the protocol families don't match" do
input = Addrinfo.tcp('::1', 0)
- lambda { @source.family_addrinfo(input) }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo(input) }.should raise_error(ArgumentError)
end
it "raises ArgumentError if the socket types don't match" do
input = Addrinfo.udp('127.0.0.1', 0)
- lambda { @source.family_addrinfo(input) }.should raise_error(ArgumentError)
+ -> { @source.family_addrinfo(input) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/addrinfo/initialize_spec.rb b/spec/ruby/library/socket/addrinfo/initialize_spec.rb
index 460fc28d49..8354553f61 100644
--- a/spec/ruby/library/socket/addrinfo/initialize_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/initialize_spec.rb
@@ -198,7 +198,7 @@ describe "Addrinfo#initialize" do
describe 'with an invalid IP address' do
it 'raises SocketError' do
- block = lambda { Addrinfo.new(['AF_INET6', 80, 'hostname', '127.0.0.1']) }
+ block = -> { Addrinfo.new(['AF_INET6', 80, 'hostname', '127.0.0.1']) }
block.should raise_error(SocketError)
end
@@ -290,7 +290,7 @@ describe "Addrinfo#initialize" do
it "raises SocketError when using SOCK_RDM" do
sockaddr = ['AF_INET', 80, 'hostname', '127.0.0.1']
value = Socket::SOCK_RDM
- block = lambda { Addrinfo.new(sockaddr, nil, value) }
+ block = -> { Addrinfo.new(sockaddr, nil, value) }
block.should raise_error(SocketError)
end
@@ -364,7 +364,7 @@ describe "Addrinfo#initialize" do
(Socket.constants.grep(/^IPPROTO/) - valid).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, nil, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, nil, value) }
block.should raise_error(SocketError)
end
@@ -392,7 +392,7 @@ describe "Addrinfo#initialize" do
(Socket.constants.grep(/^IPPROTO/) - valid).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
block.should raise_error(SocketError)
end
@@ -409,7 +409,7 @@ describe "Addrinfo#initialize" do
Socket.constants.grep(/^IPPROTO/).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
block.should raise_error(SocketError)
end
@@ -440,7 +440,7 @@ describe "Addrinfo#initialize" do
Socket.constants.grep(/^IPPROTO/).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
block.should raise_error(SocketError)
end
@@ -467,7 +467,7 @@ describe "Addrinfo#initialize" do
(Socket.constants.grep(/^IPPROTO/) - valid).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
block.should raise_error(SocketError)
end
@@ -495,7 +495,7 @@ describe "Addrinfo#initialize" do
(Socket.constants.grep(/^IPPROTO/) - valid).each do |type|
it "raises SocketError when using #{type}" do
value = Socket.const_get(type)
- block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) }
+ block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
block.should raise_error(SocketError)
end
diff --git a/spec/ruby/library/socket/addrinfo/ip_address_spec.rb b/spec/ruby/library/socket/addrinfo/ip_address_spec.rb
index d53c00267a..4522cf5cfd 100644
--- a/spec/ruby/library/socket/addrinfo/ip_address_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/ip_address_spec.rb
@@ -28,7 +28,7 @@ describe "Addrinfo#ip_address" do
end
it "raises an exception" do
- lambda { @addrinfo.ip_address }.should raise_error(SocketError)
+ -> { @addrinfo.ip_address }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/addrinfo/ip_port_spec.rb b/spec/ruby/library/socket/addrinfo/ip_port_spec.rb
index 6cf9e7a18e..4118607db0 100644
--- a/spec/ruby/library/socket/addrinfo/ip_port_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/ip_port_spec.rb
@@ -28,7 +28,7 @@ describe "Addrinfo#ip_port" do
end
it "raises an exception" do
- lambda { @addrinfo.ip_port }.should raise_error(SocketError)
+ -> { @addrinfo.ip_port }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb b/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb
index 57ae79a6c8..6c81c48d1c 100644
--- a/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb
@@ -28,7 +28,7 @@ describe "Addrinfo#ip_unpack" do
end
it "raises an exception" do
- lambda { @addrinfo.ip_unpack }.should raise_error(SocketError)
+ -> { @addrinfo.ip_unpack }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/addrinfo/unix_path_spec.rb b/spec/ruby/library/socket/addrinfo/unix_path_spec.rb
index 0f25881724..6bfb56a4ac 100644
--- a/spec/ruby/library/socket/addrinfo/unix_path_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/unix_path_spec.rb
@@ -9,7 +9,7 @@ with_feature :unix_socket do
end
it "raises an exception" do
- lambda { @addrinfo.unix_path }.should raise_error(SocketError)
+ -> { @addrinfo.unix_path }.should raise_error(SocketError)
end
end
@@ -20,7 +20,7 @@ with_feature :unix_socket do
end
it "raises an exception" do
- lambda { @addrinfo.unix_path }.should raise_error(SocketError)
+ -> { @addrinfo.unix_path }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb b/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb
index 50763e28b1..c54ee29825 100644
--- a/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb
@@ -26,7 +26,7 @@ with_feature :ancillary_data do
end
it 'raises SocketError when comparing with :IPV6 and :RIGHTS' do
- lambda { @data.cmsg_is?(:IPV6, :RIGHTS) }.should raise_error(SocketError)
+ -> { @data.cmsg_is?(:IPV6, :RIGHTS) }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/ancillarydata/initialize_spec.rb b/spec/ruby/library/socket/ancillarydata/initialize_spec.rb
index d4788d0f68..344d1485c5 100644
--- a/spec/ruby/library/socket/ancillarydata/initialize_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/initialize_spec.rb
@@ -113,25 +113,25 @@ with_feature :ancillary_data do
end
it 'raises TypeError when using a numeric string as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :IGMP, Socket::SCM_RIGHTS.to_s, '')
}.should raise_error(TypeError)
end
it 'raises SocketError when using :RECVTTL as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :SOCKET, :RECVTTL, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :MOO as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :SOCKET, :MOO, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :IP_RECVTTL as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :SOCKET, :IP_RECVTTL, '')
}.should raise_error(SocketError)
end
@@ -155,13 +155,13 @@ with_feature :ancillary_data do
end
it 'raises SocketError when using :RIGHTS as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :IP, :RIGHTS, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :MOO as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :IP, :MOO, '')
}.should raise_error(SocketError)
end
@@ -179,13 +179,13 @@ with_feature :ancillary_data do
end
it 'raises SocketError when using :RIGHTS as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :IPV6, :RIGHTS, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :MOO as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :IPV6, :MOO, '')
}.should raise_error(SocketError)
end
@@ -205,13 +205,13 @@ with_feature :ancillary_data do
end
it 'raises SocketError when using :RIGHTS as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :TCP, :RIGHTS, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :MOO as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :TCP, :MOO, '')
}.should raise_error(SocketError)
end
@@ -225,13 +225,13 @@ with_feature :ancillary_data do
end
it 'raises SocketError when using :RIGHTS as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :UDP, :RIGHTS, '')
}.should raise_error(SocketError)
end
it 'raises SocketError when using :MOO as the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:INET, :UDP, :MOO, '')
}.should raise_error(SocketError)
end
@@ -243,7 +243,7 @@ with_feature :ancillary_data do
end
it 'raises SocketError when using :CORK sa the type argument' do
- lambda {
+ -> {
Socket::AncillaryData.new(:UNIX, :SOCKET, :CORK, '')
}.should raise_error(SocketError)
end
@@ -251,7 +251,7 @@ with_feature :ancillary_data do
describe 'using :AF_UNIX as the family and :IP as the level' do
it 'raises SocketError' do
- lambda {
+ -> {
Socket::AncillaryData.new(:UNIX, :IP, :RECVTTL, '')
}.should raise_error(SocketError)
end
@@ -259,7 +259,7 @@ with_feature :ancillary_data do
describe 'using :AF_UNIX as the family and :IPV6 as the level' do
it 'raises SocketError' do
- lambda {
+ -> {
Socket::AncillaryData.new(:UNIX, :IPV6, :NEXTHOP, '')
}.should raise_error(SocketError)
end
@@ -267,7 +267,7 @@ with_feature :ancillary_data do
describe 'using :AF_UNIX as the family and :TCP as the level' do
it 'raises SocketError' do
- lambda {
+ -> {
Socket::AncillaryData.new(:UNIX, :TCP, :CORK, '')
}.should raise_error(SocketError)
end
@@ -275,7 +275,7 @@ with_feature :ancillary_data do
describe 'using :AF_UNIX as the family and :UDP as the level' do
it 'raises SocketError' do
- lambda {
+ -> {
Socket::AncillaryData.new(:UNIX, :UDP, :CORK, '')
}.should raise_error(SocketError)
end
diff --git a/spec/ruby/library/socket/ancillarydata/int_spec.rb b/spec/ruby/library/socket/ancillarydata/int_spec.rb
index 0d7c5e3652..fe41a30a1a 100644
--- a/spec/ruby/library/socket/ancillarydata/int_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/int_spec.rb
@@ -37,7 +37,7 @@ with_feature :ancillary_data do
it 'raises when the data is not an Integer' do
data = Socket::AncillaryData.new(:UNIX, :SOCKET, :RIGHTS, 'ugh')
- lambda { data.int }.should raise_error(TypeError)
+ -> { data.int }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb b/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb
index 9fc4e8c201..84910a038a 100644
--- a/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb
@@ -89,7 +89,7 @@ with_feature :ancillary_data, :pktinfo do
end
it 'is not the same object as the input Addrinfo' do
- @addr.should_not.equal? @source
+ @addr.should_not equal @source
end
end
@@ -109,7 +109,7 @@ with_feature :ancillary_data, :pktinfo do
end
it 'is not the same object as the input Addrinfo' do
- @addr.should_not.equal? @dest
+ @addr.should_not equal @dest
end
end
end
diff --git a/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb b/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb
index 6f576f5169..0fffc720dc 100644
--- a/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb
@@ -58,7 +58,7 @@ with_feature :ancillary_data, :ipv6_pktinfo do
end
it 'is not the same object as the input Addrinfo' do
- @addr.should_not.equal? @source
+ @addr.should_not equal @source
end
end
diff --git a/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb b/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb
index 34d954af81..65ffcb01af 100644
--- a/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb
@@ -26,7 +26,7 @@ with_feature :ancillary_data do
describe 'using non IO objects' do
it 'raises TypeError' do
- lambda { Socket::AncillaryData.unix_rights(10) }.should raise_error(TypeError)
+ -> { Socket::AncillaryData.unix_rights(10) }.should raise_error(TypeError)
end
end
end
@@ -47,14 +47,14 @@ with_feature :ancillary_data do
it 'raises TypeError when the level is not SOL_SOCKET' do
data = Socket::AncillaryData.new(:INET, :IP, :RECVTTL, '')
- lambda { data.unix_rights }.should raise_error(TypeError)
+ -> { data.unix_rights }.should raise_error(TypeError)
end
platform_is_not :"solaris2.10", :aix do
it 'raises TypeError when the type is not SCM_RIGHTS' do
data = Socket::AncillaryData.new(:INET, :SOCKET, :TIMESTAMP, '')
- lambda { data.unix_rights }.should raise_error(TypeError)
+ -> { data.unix_rights }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/close_read_spec.rb b/spec/ruby/library/socket/basicsocket/close_read_spec.rb
index c989fcaf72..f317b34955 100644
--- a/spec/ruby/library/socket/basicsocket/close_read_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/close_read_spec.rb
@@ -12,13 +12,13 @@ describe "Socket::BasicSocket#close_read" do
it "closes the reading end of the socket" do
@server.close_read
- lambda { @server.read }.should raise_error(IOError)
+ -> { @server.read }.should raise_error(IOError)
end
it 'does not raise when called on a socket already closed for reading' do
@server.close_read
@server.close_read
- lambda { @server.read }.should raise_error(IOError)
+ -> { @server.read }.should raise_error(IOError)
end
it 'does not fully close the socket' do
@@ -34,7 +34,7 @@ describe "Socket::BasicSocket#close_read" do
it 'raises IOError when called on a fully closed socket' do
@server.close
- lambda { @server.close_read }.should raise_error(IOError)
+ -> { @server.close_read }.should raise_error(IOError)
end
it "returns nil" do
diff --git a/spec/ruby/library/socket/basicsocket/close_write_spec.rb b/spec/ruby/library/socket/basicsocket/close_write_spec.rb
index f37e0e5074..232cfbb7c6 100644
--- a/spec/ruby/library/socket/basicsocket/close_write_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/close_write_spec.rb
@@ -12,13 +12,13 @@ describe "Socket::BasicSocket#close_write" do
it "closes the writing end of the socket" do
@server.close_write
- lambda { @server.write("foo") }.should raise_error(IOError)
+ -> { @server.write("foo") }.should raise_error(IOError)
end
it 'does not raise when called on a socket already closed for writing' do
@server.close_write
@server.close_write
- lambda { @server.write("foo") }.should raise_error(IOError)
+ -> { @server.write("foo") }.should raise_error(IOError)
end
it 'does not fully close the socket' do
@@ -39,7 +39,7 @@ describe "Socket::BasicSocket#close_write" do
it 'raises IOError when called on a fully closed socket' do
@server.close
- lambda { @server.close_write }.should raise_error(IOError)
+ -> { @server.close_write }.should raise_error(IOError)
end
it "returns nil" do
diff --git a/spec/ruby/library/socket/basicsocket/connect_address_spec.rb b/spec/ruby/library/socket/basicsocket/connect_address_spec.rb
index 18baac7f17..1a1c9982d9 100644
--- a/spec/ruby/library/socket/basicsocket/connect_address_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/connect_address_spec.rb
@@ -10,7 +10,7 @@ describe 'Socket#connect_address' do
it 'raises SocketError' do
@sock = Socket.new(:INET, :STREAM)
- lambda { @sock.connect_address }.should raise_error(SocketError)
+ -> { @sock.connect_address }.should raise_error(SocketError)
end
end
@@ -110,7 +110,7 @@ describe 'Socket#connect_address' do
end
it 'raises SocketError' do
- lambda { @client.connect_address }.should raise_error(SocketError)
+ -> { @client.connect_address }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb b/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb
index 9eeb6d0e0b..6179211d96 100644
--- a/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb
@@ -30,7 +30,7 @@ describe 'BasicSocket#getpeereid' do
it 'raises NoMethodError' do
@sock = TCPServer.new('127.0.0.1', 0)
- lambda { @sock.getpeereid }.should raise_error(NoMethodError)
+ -> { @sock.getpeereid }.should raise_error(NoMethodError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/getpeername_spec.rb b/spec/ruby/library/socket/basicsocket/getpeername_spec.rb
index 23c73056cd..0b93f02eef 100644
--- a/spec/ruby/library/socket/basicsocket/getpeername_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/getpeername_spec.rb
@@ -20,6 +20,6 @@ describe "Socket::BasicSocket#getpeername" do
end
it 'raises Errno::ENOTCONN for a disconnected socket' do
- lambda { @server.getpeername }.should raise_error(Errno::ENOTCONN)
+ -> { @server.getpeername }.should raise_error(Errno::ENOTCONN)
end
end
diff --git a/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb b/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb
index aad21ca535..ce65d6c92b 100644
--- a/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb
@@ -41,7 +41,7 @@ describe "BasicSocket#getsockopt" do
end
it "raises a SystemCallError with an invalid socket option" do
- lambda { @sock.getsockopt Socket::SOL_SOCKET, -1 }.should raise_error(Errno::ENOPROTOOPT)
+ -> { @sock.getsockopt Socket::SOL_SOCKET, -1 }.should raise_error(Errno::ENOPROTOOPT)
end
it 'returns a Socket::Option using a constant' do
@@ -69,7 +69,7 @@ describe "BasicSocket#getsockopt" do
end
it 'raises Errno::ENOPROTOOPT when requesting an invalid option' do
- lambda { @sock.getsockopt(Socket::SOL_SOCKET, -1) }.should raise_error(Errno::ENOPROTOOPT)
+ -> { @sock.getsockopt(Socket::SOL_SOCKET, -1) }.should raise_error(Errno::ENOPROTOOPT)
end
describe 'using Symbols as arguments' do
diff --git a/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb b/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb
index 26683b3d23..0363f2f8de 100644
--- a/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb
@@ -16,14 +16,14 @@ describe "Socket::BasicSocket#recv_nonblock" do
platform_is_not :windows do
describe 'using an unbound socket' do
it 'raises an exception extending IO::WaitReadable' do
- lambda { @s1.recv_nonblock(1) }.should raise_error(IO::WaitReadable)
+ -> { @s1.recv_nonblock(1) }.should raise_error(IO::WaitReadable)
end
end
end
it "raises an exception extending IO::WaitReadable if there's no data available" do
@s1.bind(Socket.pack_sockaddr_in(0, ip_address))
- lambda {
+ -> {
@s1.recv_nonblock(5)
}.should raise_error(IO::WaitReadable) { |e|
platform_is_not :windows do
@@ -62,7 +62,7 @@ describe "Socket::BasicSocket#recv_nonblock" do
@s2.send("a", 0, @s1.getsockname)
IO.select([@s1], nil, nil, 2)
@s1.recv_nonblock(1).should == "a"
- lambda {
+ -> {
@s1.recv_nonblock(5)
}.should raise_error(IO::WaitReadable)
end
diff --git a/spec/ruby/library/socket/basicsocket/recv_spec.rb b/spec/ruby/library/socket/basicsocket/recv_spec.rb
index a277dc2d97..b6ccda5d00 100644
--- a/spec/ruby/library/socket/basicsocket/recv_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/recv_spec.rb
@@ -107,7 +107,7 @@ describe 'BasicSocket#recv' do
describe 'using an unbound socket' do
it 'blocks the caller' do
- lambda { @server.recv(4) }.should block_caller
+ -> { @server.recv(4) }.should block_caller
end
end
@@ -118,7 +118,7 @@ describe 'BasicSocket#recv' do
describe 'without any data available' do
it 'blocks the caller' do
- lambda { @server.recv(4) }.should block_caller
+ -> { @server.recv(4) }.should block_caller
end
end
@@ -144,7 +144,7 @@ describe 'BasicSocket#recv' do
@server.recv(2).should == 'he'
- lambda { @server.recv(4) }.should block_caller
+ -> { @server.recv(4) }.should block_caller
end
it 'takes a peek at the data when using the MSG_PEEK flag' do
diff --git a/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb b/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb
index c440bac8bf..8e6c232c59 100644
--- a/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb
@@ -17,7 +17,7 @@ describe 'BasicSocket#recvmsg_nonblock' do
platform_is_not :windows do
describe 'using an unbound socket' do
it 'raises an exception extending IO::WaitReadable' do
- lambda { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable)
end
end
end
@@ -29,7 +29,7 @@ describe 'BasicSocket#recvmsg_nonblock' do
describe 'without any data available' do
it 'raises an exception extending IO::WaitReadable' do
- lambda { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable)
end
it 'returns :wait_readable with exception: false' do
@@ -132,7 +132,7 @@ describe 'BasicSocket#recvmsg_nonblock' do
describe 'without any data available' do
it 'raises IO::WaitReadable' do
- lambda {
+ -> {
socket, _ = @server.accept
begin
socket.recvmsg_nonblock
@@ -182,7 +182,7 @@ describe 'BasicSocket#recvmsg_nonblock' do
end
it 'raises when receiving the ip_address message' do
- lambda { @addr.ip_address }.should raise_error(SocketError)
+ -> { @addr.ip_address }.should raise_error(SocketError)
end
it 'uses the correct address family' do
@@ -198,7 +198,7 @@ describe 'BasicSocket#recvmsg_nonblock' do
end
it 'raises when receiving the ip_port message' do
- lambda { @addr.ip_port }.should raise_error(SocketError)
+ -> { @addr.ip_port }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb b/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb
index 58eb8d0360..8063723701 100644
--- a/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb
@@ -17,7 +17,7 @@ describe 'BasicSocket#recvmsg' do
platform_is_not :windows do
describe 'using an unbound socket' do
it 'blocks the caller' do
- lambda { @server.recvmsg }.should block_caller
+ -> { @server.recvmsg }.should block_caller
end
end
end
@@ -29,7 +29,7 @@ describe 'BasicSocket#recvmsg' do
describe 'without any data available' do
it 'blocks the caller' do
- lambda { @server.recvmsg }.should block_caller
+ -> { @server.recvmsg }.should block_caller
end
end
@@ -126,7 +126,7 @@ describe 'BasicSocket#recvmsg' do
it 'blocks the caller' do
socket, _ = @server.accept
begin
- lambda { socket.recvmsg }.should block_caller
+ -> { socket.recvmsg }.should block_caller
ensure
socket.close
end
@@ -170,7 +170,7 @@ describe 'BasicSocket#recvmsg' do
end
it 'raises when receiving the ip_address message' do
- lambda { @addr.ip_address }.should raise_error(SocketError)
+ -> { @addr.ip_address }.should raise_error(SocketError)
end
it 'uses the correct address family' do
@@ -186,7 +186,7 @@ describe 'BasicSocket#recvmsg' do
end
it 'raises when receiving the ip_port message' do
- lambda { @addr.ip_port }.should raise_error(SocketError)
+ -> { @addr.ip_port }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/send_spec.rb b/spec/ruby/library/socket/basicsocket/send_spec.rb
index c4845fc09e..041ee46998 100644
--- a/spec/ruby/library/socket/basicsocket/send_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/send_spec.rb
@@ -101,7 +101,7 @@ describe 'BasicSocket#send' do
describe 'without a destination address' do
it "raises #{SocketSpecs.dest_addr_req_error}" do
- lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
@@ -113,7 +113,7 @@ describe 'BasicSocket#send' do
it 'does not persist the connection after writing to the socket' do
@client.send('hello', 0, @server.getsockname)
- lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
@@ -161,7 +161,7 @@ describe 'BasicSocket#send' do
it 'sends the message to the given address instead' do
@client.send('hello', 0, @alt_server.getsockname).should == 5
- lambda { @server.recv(5) }.should block_caller
+ -> { @server.recv(5) }.should block_caller
@alt_server.recv(5).should == 'hello'
end
diff --git a/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb b/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb
index 000971f6af..c112f2ab4a 100644
--- a/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb
@@ -18,7 +18,7 @@ describe 'BasicSocket#sendmsg_nonblock' do
describe 'without a destination address' do
it "raises #{SocketSpecs.dest_addr_req_error}" do
- lambda { @client.sendmsg_nonblock('hello') }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.sendmsg_nonblock('hello') }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
@@ -70,7 +70,7 @@ describe 'BasicSocket#sendmsg_nonblock' do
it 'sends the message to the given address instead' do
@client.sendmsg_nonblock('hello', 0, @alt_server.getsockname).should == 5
- lambda { @server.recv(5) }.should block_caller
+ -> { @server.recv(5) }.should block_caller
@alt_server.recv(5).should == 'hello'
end
end
@@ -94,7 +94,7 @@ describe 'BasicSocket#sendmsg_nonblock' do
end
it 'raises IO::WaitWritable when the underlying buffer is full' do
- lambda {
+ -> {
10.times { @client.sendmsg_nonblock('hello' * 1_000_000) }
}.should raise_error(IO::WaitWritable)
end
diff --git a/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb b/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb
index f2c11f443a..7ff336c0b7 100644
--- a/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb
@@ -19,7 +19,7 @@ describe 'BasicSocket#sendmsg' do
platform_is_not :windows do
describe 'without a destination address' do
it "raises #{SocketSpecs.dest_addr_req_error}" do
- lambda { @client.sendmsg('hello') }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.sendmsg('hello') }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
end
@@ -74,7 +74,7 @@ describe 'BasicSocket#sendmsg' do
it 'sends the message to the given address instead' do
@client.sendmsg('hello', 0, @alt_server.getsockname).should == 5
- lambda { @server.recv(5) }.should block_caller
+ -> { @server.recv(5) }.should block_caller
@alt_server.recv(5).should == 'hello'
end
@@ -101,7 +101,7 @@ describe 'BasicSocket#sendmsg' do
it 'blocks when the underlying buffer is full' do
# Buffer sizes may differ per platform, so sadly this is the only
# reliable way of testing blocking behaviour.
- lambda do
+ -> do
10.times { @client.sendmsg('hello' * 1_000_000) }
end.should block_caller
end
diff --git a/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb b/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
index 1471b03798..1e8d84e1c9 100644
--- a/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
@@ -38,7 +38,7 @@ describe "BasicSocket#setsockopt" do
platform_is_not :windows do
it "raises EINVAL if passed wrong linger value" do
- lambda do
+ -> do
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, 0)
end.should raise_error(Errno::EINVAL)
end
@@ -70,7 +70,7 @@ describe "BasicSocket#setsockopt" do
n.should_not == [0].pack("i")
platform_is_not :windows do
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "")
}.should raise_error(SystemCallError)
end
@@ -80,7 +80,7 @@ describe "BasicSocket#setsockopt" do
n.should_not == [0].pack("i")
platform_is_not :windows do
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "0")
}.should raise_error(SystemCallError)
end
@@ -90,13 +90,13 @@ describe "BasicSocket#setsockopt" do
n.should == [0].pack("i")
platform_is_not :windows do
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "1")
}.should raise_error(SystemCallError)
end
platform_is_not :windows do
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "\x00\x00\x00")
}.should raise_error(SystemCallError)
end
@@ -125,7 +125,7 @@ describe "BasicSocket#setsockopt" do
n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF).to_s
n.unpack('i')[0].should >= 1
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, nil).should == 0
}.should raise_error(TypeError)
@@ -137,23 +137,23 @@ describe "BasicSocket#setsockopt" do
n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF).to_s
n.unpack('i')[0].should >= 2
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "")
}.should raise_error(SystemCallError)
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "bla")
}.should raise_error(SystemCallError)
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "0")
}.should raise_error(SystemCallError)
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "1")
}.should raise_error(SystemCallError)
- lambda {
+ -> {
@sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "\x00\x00\x00")
}.should raise_error(SystemCallError)
@@ -224,7 +224,7 @@ describe 'BasicSocket#setsockopt' do
describe 'using separate arguments with Symbols' do
it 'raises TypeError when the first argument is nil' do
- lambda { @socket.setsockopt(nil, :REUSEADDR, true) }.should raise_error(TypeError)
+ -> { @socket.setsockopt(nil, :REUSEADDR, true) }.should raise_error(TypeError)
end
it 'sets a boolean option' do
@@ -251,7 +251,7 @@ describe 'BasicSocket#setsockopt' do
platform_is_not :windows do
it 'raises Errno::EINVAL when setting an invalid option value' do
- lambda { @socket.setsockopt(:SOCKET, :OOBINLINE, 'bla') }.should raise_error(Errno::EINVAL)
+ -> { @socket.setsockopt(:SOCKET, :OOBINLINE, 'bla') }.should raise_error(Errno::EINVAL)
end
end
end
@@ -305,12 +305,12 @@ describe 'BasicSocket#setsockopt' do
it 'raises ArgumentError when passing 2 arguments' do
option = Socket::Option.bool(:INET, :SOCKET, :REUSEADDR, true)
- lambda { @socket.setsockopt(option, :REUSEADDR) }.should raise_error(ArgumentError)
+ -> { @socket.setsockopt(option, :REUSEADDR) }.should raise_error(ArgumentError)
end
it 'raises TypeError when passing 3 arguments' do
option = Socket::Option.bool(:INET, :SOCKET, :REUSEADDR, true)
- lambda { @socket.setsockopt(option, :REUSEADDR, true) }.should raise_error(TypeError)
+ -> { @socket.setsockopt(option, :REUSEADDR, true) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/basicsocket/shutdown_spec.rb b/spec/ruby/library/socket/basicsocket/shutdown_spec.rb
index 87a32ae1dc..41d9581bde 100644
--- a/spec/ruby/library/socket/basicsocket/shutdown_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/shutdown_spec.rb
@@ -29,7 +29,7 @@ platform_is_not :windows do # hangs
it 'shuts down a socket for writing' do
@client.shutdown(Socket::SHUT_WR)
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'shuts down a socket for reading and writing' do
@@ -37,11 +37,11 @@ platform_is_not :windows do # hangs
@client.recv(1).should be_empty
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'raises ArgumentError when using an invalid option' do
- lambda { @server.shutdown(666) }.should raise_error(ArgumentError)
+ -> { @server.shutdown(666) }.should raise_error(ArgumentError)
end
end
@@ -61,13 +61,13 @@ platform_is_not :windows do # hangs
it 'shuts down a socket for writing using :WR' do
@client.shutdown(:WR)
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'shuts down a socket for writing using :SHUT_WR' do
@client.shutdown(:SHUT_WR)
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'shuts down a socket for reading and writing' do
@@ -75,11 +75,11 @@ platform_is_not :windows do # hangs
@client.recv(1).should be_empty
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'raises ArgumentError when using an invalid option' do
- lambda { @server.shutdown(:Nope) }.should raise_error(SocketError)
+ -> { @server.shutdown(:Nope) }.should raise_error(SocketError)
end
end
@@ -99,17 +99,17 @@ platform_is_not :windows do # hangs
it 'shuts down a socket for writing using "WR"' do
@client.shutdown('WR')
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'shuts down a socket for writing using "SHUT_WR"' do
@client.shutdown('SHUT_WR')
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
it 'raises ArgumentError when using an invalid option' do
- lambda { @server.shutdown('Nope') }.should raise_error(SocketError)
+ -> { @server.shutdown('Nope') }.should raise_error(SocketError)
end
end
@@ -141,13 +141,13 @@ platform_is_not :windows do # hangs
@client.recv(1).should be_empty
- lambda { @client.write('hello') }.should raise_error(Errno::EPIPE)
+ -> { @client.write('hello') }.should raise_error(Errno::EPIPE)
end
end
describe 'using an object that does not respond to #to_str' do
it 'raises TypeError' do
- lambda { @server.shutdown(mock(:dummy)) }.should raise_error(TypeError)
+ -> { @server.shutdown(mock(:dummy)) }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/ipsocket/addr_spec.rb b/spec/ruby/library/socket/ipsocket/addr_spec.rb
index 07f4cb20c9..199eb85ab7 100644
--- a/spec/ruby/library/socket/ipsocket/addr_spec.rb
+++ b/spec/ruby/library/socket/ipsocket/addr_spec.rb
@@ -81,7 +81,7 @@ describe 'Socket::IPSocket#addr' do
describe 'using :cats as the argument' do
it 'raises ArgumentError' do
- lambda { @server.addr(:cats) }.should raise_error(ArgumentError)
+ -> { @server.addr(:cats) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/ipsocket/getaddress_spec.rb b/spec/ruby/library/socket/ipsocket/getaddress_spec.rb
index 8e14707d4f..746d2ab86b 100644
--- a/spec/ruby/library/socket/ipsocket/getaddress_spec.rb
+++ b/spec/ruby/library/socket/ipsocket/getaddress_spec.rb
@@ -18,7 +18,7 @@ describe "Socket::IPSocket#getaddress" do
# DNS servers like opendns return A records for ANY host, including
# traditionally invalidly named ones.
it "raises an error on unknown hostnames" do
- lambda {
+ -> {
IPSocket.getaddress("rubyspecdoesntexist.fallingsnow.net")
}.should raise_error(SocketError)
end
diff --git a/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb b/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb
index 26aa61d1c4..702650940b 100644
--- a/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb
+++ b/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb
@@ -16,7 +16,7 @@ describe "Socket::IPSocket#peeraddr" do
end
it "raises error if socket is not connected" do
- lambda {
+ -> {
@server.peeraddr
}.should raise_error(Errno::ENOTCONN)
end
@@ -92,7 +92,7 @@ describe 'Socket::IPSocket#peeraddr' do
describe 'using :cats as the argument' do
it 'raises ArgumentError' do
- lambda { @client.peeraddr(:cats) }.should raise_error(ArgumentError)
+ -> { @client.peeraddr(:cats) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/option/bool_spec.rb b/spec/ruby/library/socket/option/bool_spec.rb
index c4f8a277ba..144a78043d 100644
--- a/spec/ruby/library/socket/option/bool_spec.rb
+++ b/spec/ruby/library/socket/option/bool_spec.rb
@@ -21,7 +21,7 @@ describe "Socket::Option#bool" do
platform_is_not :windows do
it 'raises TypeError when called on a non boolean option' do
opt = Socket::Option.linger(1, 4)
- lambda { opt.bool }.should raise_error(TypeError)
+ -> { opt.bool }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/option/initialize_spec.rb b/spec/ruby/library/socket/option/initialize_spec.rb
index 0d4621b71e..8071ad7ef0 100644
--- a/spec/ruby/library/socket/option/initialize_spec.rb
+++ b/spec/ruby/library/socket/option/initialize_spec.rb
@@ -32,19 +32,19 @@ describe 'Socket::Option#initialize' do
end
it 'raises when using an invalid address family' do
- lambda {
+ -> {
Socket::Option.new(:INET2, :SOCKET, :KEEPALIVE, @bool)
}.should raise_error(SocketError)
end
it 'raises when using an invalid level' do
- lambda {
+ -> {
Socket::Option.new(:INET, :CATS, :KEEPALIVE, @bool)
}.should raise_error(SocketError)
end
it 'raises when using an invalid option name' do
- lambda {
+ -> {
Socket::Option.new(:INET, :SOCKET, :CATS, @bool)
}.should raise_error(SocketError)
end
@@ -63,19 +63,19 @@ describe 'Socket::Option#initialize' do
end
it 'raises when using an invalid address family' do
- lambda {
+ -> {
Socket::Option.new('INET2', 'SOCKET', 'KEEPALIVE', @bool)
}.should raise_error(SocketError)
end
it 'raises when using an invalid level' do
- lambda {
+ -> {
Socket::Option.new('INET', 'CATS', 'KEEPALIVE', @bool)
}.should raise_error(SocketError)
end
it 'raises when using an invalid option name' do
- lambda {
+ -> {
Socket::Option.new('INET', 'SOCKET', 'CATS', @bool)
}.should raise_error(SocketError)
end
diff --git a/spec/ruby/library/socket/option/int_spec.rb b/spec/ruby/library/socket/option/int_spec.rb
index 5c67ec26d8..8c69ef6cbd 100644
--- a/spec/ruby/library/socket/option/int_spec.rb
+++ b/spec/ruby/library/socket/option/int_spec.rb
@@ -37,7 +37,7 @@ describe "Socket::Option#int" do
platform_is_not :windows do
it 'raises TypeError when called on a non integer option' do
opt = Socket::Option.linger(1, 4)
- lambda { opt.int }.should raise_error(TypeError)
+ -> { opt.int }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/option/linger_spec.rb b/spec/ruby/library/socket/option/linger_spec.rb
index 94467ebf71..ee987db85b 100644
--- a/spec/ruby/library/socket/option/linger_spec.rb
+++ b/spec/ruby/library/socket/option/linger_spec.rb
@@ -52,25 +52,25 @@ describe "Socket::Option#linger" do
it "raises TypeError if not a SO_LINGER" do
so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :KEEPALIVE, 1)
- lambda { so.linger }.should raise_error(TypeError)
+ -> { so.linger }.should raise_error(TypeError)
end
it 'raises TypeError when called on a non SOL_SOCKET/SO_LINGER option' do
opt = Socket::Option.int(:INET, :IP, :TTL, 4)
- lambda { opt.linger }.should raise_error(TypeError)
+ -> { opt.linger }.should raise_error(TypeError)
end
platform_is_not :windows do
it "raises TypeError if option has not good size" do
so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :LINGER, 1)
- lambda { so.linger }.should raise_error(TypeError)
+ -> { so.linger }.should raise_error(TypeError)
end
end
it 'raises TypeError when called on a non linger option' do
opt = Socket::Option.new(:INET, :SOCKET, :LINGER, '')
- lambda { opt.linger }.should raise_error(TypeError)
+ -> { opt.linger }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/socket/option/new_spec.rb b/spec/ruby/library/socket/option/new_spec.rb
index f3b7b31c91..a9e6f09097 100644
--- a/spec/ruby/library/socket/option/new_spec.rb
+++ b/spec/ruby/library/socket/option/new_spec.rb
@@ -22,14 +22,14 @@ describe "Socket::Option.new" do
end
it "should raise error on unknown family" do
- lambda { Socket::Option.new(:INET4, :SOCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError)
+ -> { Socket::Option.new(:INET4, :SOCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError)
end
it "should raise error on unknown level" do
- lambda { Socket::Option.new(:INET, :ROCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError)
+ -> { Socket::Option.new(:INET, :ROCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError)
end
it "should raise error on unknown option name" do
- lambda { Socket::Option.new(:INET, :SOCKET, :ALIVE, [0].pack('i')) }.should raise_error(SocketError)
+ -> { Socket::Option.new(:INET, :SOCKET, :ALIVE, [0].pack('i')) }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/shared/pack_sockaddr.rb b/spec/ruby/library/socket/shared/pack_sockaddr.rb
index 40b0d8d59e..2df09027c9 100644
--- a/spec/ruby/library/socket/shared/pack_sockaddr.rb
+++ b/spec/ruby/library/socket/shared/pack_sockaddr.rb
@@ -93,7 +93,7 @@ describe :socket_pack_sockaddr_un, shared: true do
it "raises ArgumentError for paths that are too long" do
# AIX doesn't raise error
long_path = 'a' * 110
- lambda { Socket.public_send(@method, long_path) }.should raise_error(ArgumentError)
+ -> { Socket.public_send(@method, long_path) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/shared/socketpair.rb b/spec/ruby/library/socket/shared/socketpair.rb
index 08db2e59b8..25146cfff6 100644
--- a/spec/ruby/library/socket/shared/socketpair.rb
+++ b/spec/ruby/library/socket/shared/socketpair.rb
@@ -42,11 +42,11 @@ describe :socket_socketpair, shared: true do
end
it 'raises SocketError for an unknown address family' do
- lambda { Socket.public_send(@method, :CATS, :STREAM) }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, :CATS, :STREAM) }.should raise_error(SocketError)
end
it 'raises SocketError for an unknown socket type' do
- lambda { Socket.public_send(@method, :UNIX, :CATS) }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, :UNIX, :CATS) }.should raise_error(SocketError)
end
end
@@ -61,11 +61,11 @@ describe :socket_socketpair, shared: true do
end
it 'raises SocketError for an unknown address family' do
- lambda { Socket.public_send(@method, 'CATS', 'STREAM') }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, 'CATS', 'STREAM') }.should raise_error(SocketError)
end
it 'raises SocketError for an unknown socket type' do
- lambda { Socket.public_send(@method, 'UNIX', 'CATS') }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, 'UNIX', 'CATS') }.should raise_error(SocketError)
end
end
@@ -92,7 +92,7 @@ describe :socket_socketpair, shared: true do
family.stub!(:to_str).and_return(Socket::AF_UNIX)
type.stub!(:to_str).and_return(Socket::SOCK_STREAM)
- lambda { Socket.public_send(@method, family, type) }.should raise_error(TypeError)
+ -> { Socket.public_send(@method, family, type) }.should raise_error(TypeError)
end
it 'raises SocketError for an unknown address family' do
@@ -102,7 +102,7 @@ describe :socket_socketpair, shared: true do
family.stub!(:to_str).and_return('CATS')
type.stub!(:to_str).and_return('STREAM')
- lambda { Socket.public_send(@method, family, type) }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, family, type) }.should raise_error(SocketError)
end
it 'raises SocketError for an unknown socket type' do
@@ -112,7 +112,7 @@ describe :socket_socketpair, shared: true do
family.stub!(:to_str).and_return('UNIX')
type.stub!(:to_str).and_return('CATS')
- lambda { Socket.public_send(@method, family, type) }.should raise_error(SocketError)
+ -> { Socket.public_send(@method, family, type) }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/socket/accept_loop_spec.rb b/spec/ruby/library/socket/socket/accept_loop_spec.rb
index ee11569da3..78e8c3fa4a 100644
--- a/spec/ruby/library/socket/socket/accept_loop_spec.rb
+++ b/spec/ruby/library/socket/socket/accept_loop_spec.rb
@@ -20,7 +20,7 @@ describe 'Socket.accept_loop' do
# https://ci.appveyor.com/project/ruby/ruby/builds/20817932/job/dor2ipny7ru4erpa
platform_is_not :windows do
it 'blocks the caller' do
- lambda { Socket.accept_loop([@server]) }.should block_caller
+ -> { Socket.accept_loop([@server]) }.should block_caller
end
end
end
@@ -53,7 +53,7 @@ describe 'Socket.accept_loop' do
describe 'using separate Socket arguments' do
describe 'without any available connections' do
it 'blocks the caller' do
- lambda { Socket.accept_loop(@server) }.should block_caller
+ -> { Socket.accept_loop(@server) }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
index cde9e6a4b6..3221f0b128 100644
--- a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
+++ b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
@@ -15,7 +15,7 @@ describe "Socket#accept_nonblock" do
end
it "raises IO::WaitReadable if the connection is not accepted yet" do
- lambda {
+ -> {
@socket.accept_nonblock
}.should raise_error(IO::WaitReadable) { |e|
platform_is_not :windows do
@@ -45,7 +45,7 @@ describe 'Socket#accept_nonblock' do
describe 'using an unbound socket' do
it 'raises Errno::EINVAL' do
- lambda { @server.accept_nonblock }.should raise_error(Errno::EINVAL)
+ -> { @server.accept_nonblock }.should raise_error(Errno::EINVAL)
end
end
@@ -55,7 +55,7 @@ describe 'Socket#accept_nonblock' do
end
it 'raises Errno::EINVAL' do
- lambda { @server.accept_nonblock }.should raise_error(Errno::EINVAL)
+ -> { @server.accept_nonblock }.should raise_error(Errno::EINVAL)
end
end
@@ -63,7 +63,7 @@ describe 'Socket#accept_nonblock' do
it 'raises IOError' do
@server.close
- lambda { @server.accept_nonblock }.should raise_error(IOError)
+ -> { @server.accept_nonblock }.should raise_error(IOError)
end
end
@@ -75,7 +75,7 @@ describe 'Socket#accept_nonblock' do
describe 'without a connected client' do
it 'raises IO::WaitReadable' do
- lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
end
end
diff --git a/spec/ruby/library/socket/socket/accept_spec.rb b/spec/ruby/library/socket/socket/accept_spec.rb
index a0778caa23..417f996c55 100644
--- a/spec/ruby/library/socket/socket/accept_spec.rb
+++ b/spec/ruby/library/socket/socket/accept_spec.rb
@@ -15,7 +15,7 @@ describe 'Socket#accept' do
platform_is :linux do # hangs on other platforms
describe 'using an unbound socket' do
it 'raises Errno::EINVAL' do
- lambda { @server.accept }.should raise_error(Errno::EINVAL)
+ -> { @server.accept }.should raise_error(Errno::EINVAL)
end
end
@@ -25,7 +25,7 @@ describe 'Socket#accept' do
end
it 'raises Errno::EINVAL' do
- lambda { @server.accept }.should raise_error(Errno::EINVAL)
+ -> { @server.accept }.should raise_error(Errno::EINVAL)
end
end
end
@@ -34,7 +34,7 @@ describe 'Socket#accept' do
it 'raises IOError' do
@server.close
- lambda { @server.accept }.should raise_error(IOError)
+ -> { @server.accept }.should raise_error(IOError)
end
end
@@ -56,7 +56,6 @@ describe 'Socket#accept' do
client.connect(@server_addr)
- thread.join(5)
value = thread.value
begin
value.should be_an_instance_of(Array)
diff --git a/spec/ruby/library/socket/socket/bind_spec.rb b/spec/ruby/library/socket/socket/bind_spec.rb
index 3a7df6ed71..0349df84a6 100644
--- a/spec/ruby/library/socket/socket/bind_spec.rb
+++ b/spec/ruby/library/socket/socket/bind_spec.rb
@@ -13,7 +13,7 @@ describe "Socket#bind on SOCK_DGRAM socket" do
end
it "binds to a port" do
- lambda { @sock.bind(@sockaddr) }.should_not raise_error
+ -> { @sock.bind(@sockaddr) }.should_not raise_error
end
it "returns 0 if successful" do
@@ -23,19 +23,19 @@ describe "Socket#bind on SOCK_DGRAM socket" do
it "raises Errno::EINVAL when already bound" do
@sock.bind(@sockaddr)
- lambda { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
+ -> { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
end
it "raises Errno::EADDRNOTAVAIL when the specified sockaddr is not available from the local machine" do
sockaddr1 = Socket.pack_sockaddr_in(0, "4.3.2.1")
- lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
+ -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
end
platform_is_not :windows, :cygwin do
as_user do
it "raises Errno::EACCES when the current user does not have permission to bind" do
sockaddr1 = Socket.pack_sockaddr_in(1, "127.0.0.1")
- lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES)
+ -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES)
end
end
end
@@ -54,7 +54,7 @@ describe "Socket#bind on SOCK_STREAM socket" do
end
it "binds to a port" do
- lambda { @sock.bind(@sockaddr) }.should_not raise_error
+ -> { @sock.bind(@sockaddr) }.should_not raise_error
end
it "returns 0 if successful" do
@@ -64,19 +64,19 @@ describe "Socket#bind on SOCK_STREAM socket" do
it "raises Errno::EINVAL when already bound" do
@sock.bind(@sockaddr)
- lambda { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
+ -> { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
end
it "raises Errno::EADDRNOTAVAIL when the specified sockaddr is not available from the local machine" do
sockaddr1 = Socket.pack_sockaddr_in(0, "4.3.2.1")
- lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
+ -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
end
platform_is_not :windows, :cygwin do
as_user do
it "raises Errno::EACCES when the current user does not have permission to bind" do
sockaddr1 = Socket.pack_sockaddr_in(1, "127.0.0.1")
- lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES)
+ -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES)
end
end
end
@@ -101,14 +101,14 @@ describe 'Socket#bind' do
it 'raises Errno::EINVAL when binding to an already bound port' do
@socket.bind(@sockaddr)
- lambda { @socket.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
+ -> { @socket.bind(@sockaddr) }.should raise_error(Errno::EINVAL)
end
it 'raises Errno::EADDRNOTAVAIL when the specified sockaddr is not available' do
ip = family == Socket::AF_INET ? '4.3.2.1' : '::2'
sockaddr1 = Socket.sockaddr_in(0, ip)
- lambda { @socket.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
+ -> { @socket.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL)
end
platform_is_not :windows do
@@ -116,7 +116,7 @@ describe 'Socket#bind' do
it 'raises Errno::EACCES when the user is not allowed to bind to the port' do
sockaddr1 = Socket.pack_sockaddr_in(1, ip_address)
- lambda { @socket.bind(sockaddr1) }.should raise_error(Errno::EACCES)
+ -> { @socket.bind(sockaddr1) }.should raise_error(Errno::EACCES)
end
end
end
diff --git a/spec/ruby/library/socket/socket/connect_nonblock_spec.rb b/spec/ruby/library/socket/socket/connect_nonblock_spec.rb
index b5f416d96f..3cf667fc4a 100644
--- a/spec/ruby/library/socket/socket/connect_nonblock_spec.rb
+++ b/spec/ruby/library/socket/socket/connect_nonblock_spec.rb
@@ -53,13 +53,13 @@ describe "Socket#connect_nonblock" do
platform_is_not :freebsd, :solaris, :aix do
it "raises Errno::EINPROGRESS when the connect would block" do
- lambda do
+ -> do
@socket.connect_nonblock(@addr)
end.should raise_error(Errno::EINPROGRESS)
end
it "raises Errno::EINPROGRESS with IO::WaitWritable mixed in when the connect would block" do
- lambda do
+ -> do
@socket.connect_nonblock(@addr)
end.should raise_error(IO::WaitWritable)
end
@@ -95,7 +95,7 @@ describe 'Socket#connect_nonblock' do
end
it 'raises TypeError when passed an Integer' do
- lambda { @client.connect_nonblock(666) }.should raise_error(TypeError)
+ -> { @client.connect_nonblock(666) }.should raise_error(TypeError)
end
end
@@ -116,7 +116,7 @@ describe 'Socket#connect_nonblock' do
@server.listen(1)
@client.connect(@server.connect_address).should == 0
- lambda {
+ -> {
@client.connect_nonblock(@server.connect_address)
# A second call needed if non-blocking sockets become default
@@ -139,7 +139,7 @@ describe 'Socket#connect_nonblock' do
it 'raises IO:EINPROGRESSWaitWritable when the connection would block' do
@server.bind(@sockaddr)
- lambda {
+ -> {
@client.connect_nonblock(@server.connect_address)
}.should raise_error(IO::EINPROGRESSWaitWritable)
end
diff --git a/spec/ruby/library/socket/socket/connect_spec.rb b/spec/ruby/library/socket/socket/connect_spec.rb
index df5cc5bf34..8653fba552 100644
--- a/spec/ruby/library/socket/socket/connect_spec.rb
+++ b/spec/ruby/library/socket/socket/connect_spec.rb
@@ -32,7 +32,7 @@ describe 'Socket#connect' do
@client.connect(@server.getsockname).should == 0
- lambda {
+ -> {
@client.connect(@server.getsockname)
# A second call needed if non-blocking sockets become default
diff --git a/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb b/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb
index 639a318132..5d97341103 100644
--- a/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb
+++ b/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb
@@ -57,7 +57,7 @@ describe 'Socket.gethostbyaddr' do
end
it 'raises SocketError when the address is not supported by the family' do
- lambda { Socket.gethostbyaddr(@addr, :INET6) }.should raise_error(SocketError)
+ -> { Socket.gethostbyaddr(@addr, :INET6) }.should raise_error(SocketError)
end
end
end
@@ -115,7 +115,7 @@ describe 'Socket.gethostbyaddr' do
platform_is_not :windows do
it 'raises SocketError when the address is not supported by the family' do
- lambda { Socket.gethostbyaddr(@addr, :INET) }.should raise_error(SocketError)
+ -> { Socket.gethostbyaddr(@addr, :INET) }.should raise_error(SocketError)
end
end
end
diff --git a/spec/ruby/library/socket/socket/getnameinfo_spec.rb b/spec/ruby/library/socket/socket/getnameinfo_spec.rb
index fbbbcb53c5..b406348aa8 100644
--- a/spec/ruby/library/socket/socket/getnameinfo_spec.rb
+++ b/spec/ruby/library/socket/socket/getnameinfo_spec.rb
@@ -69,7 +69,7 @@ describe 'Socket.getnameinfo' do
end
it 'raises SocketError or TypeError when using an invalid String' do
- lambda { Socket.getnameinfo('cats') }.should raise_error(Exception) { |e|
+ -> { Socket.getnameinfo('cats') }.should raise_error(Exception) { |e|
[SocketError, TypeError].should include(e.class)
}
end
@@ -102,7 +102,7 @@ describe 'Socket.getnameinfo' do
end
it 'raises ArgumentError when using an invalid Array' do
- lambda { Socket.getnameinfo([family_name]) }.should raise_error(ArgumentError)
+ -> { Socket.getnameinfo([family_name]) }.should raise_error(ArgumentError)
end
platform_is_not :windows do
diff --git a/spec/ruby/library/socket/socket/getservbyname_spec.rb b/spec/ruby/library/socket/socket/getservbyname_spec.rb
index 9479b26228..d361e619f2 100644
--- a/spec/ruby/library/socket/socket/getservbyname_spec.rb
+++ b/spec/ruby/library/socket/socket/getservbyname_spec.rb
@@ -27,6 +27,6 @@ describe "Socket#getservbyname" do
end
it "raises a SocketError when the service or port is invalid" do
- lambda { Socket.getservbyname('invalid') }.should raise_error(SocketError)
+ -> { Socket.getservbyname('invalid') }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/socket/getservbyport_spec.rb b/spec/ruby/library/socket/socket/getservbyport_spec.rb
index 9be2ac527e..563c592b54 100644
--- a/spec/ruby/library/socket/socket/getservbyport_spec.rb
+++ b/spec/ruby/library/socket/socket/getservbyport_spec.rb
@@ -18,6 +18,6 @@ describe 'Socket.getservbyport' do
end
it 'raises SocketError for an unknown port number' do
- lambda { Socket.getservbyport(0) }.should raise_error(SocketError)
+ -> { Socket.getservbyport(0) }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/socket/initialize_spec.rb b/spec/ruby/library/socket/socket/initialize_spec.rb
index 2343c6e289..f8337bcaa5 100644
--- a/spec/ruby/library/socket/socket/initialize_spec.rb
+++ b/spec/ruby/library/socket/socket/initialize_spec.rb
@@ -53,7 +53,7 @@ describe 'Socket#initialize' do
family.stub!(:to_str).and_return(Socket::AF_INET)
type.stub!(:to_str).and_return(Socket::SOCK_STREAM)
- lambda { Socket.new(family, type) }.should raise_error(TypeError)
+ -> { Socket.new(family, type) }.should raise_error(TypeError)
end
end
@@ -65,7 +65,7 @@ describe 'Socket#initialize' do
end
it 'raises TypeError when using a Symbol' do
- lambda { Socket.new(:INET, :STREAM, :TCP) }.should raise_error(TypeError)
+ -> { Socket.new(:INET, :STREAM, :TCP) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/socket/socket/listen_spec.rb b/spec/ruby/library/socket/socket/listen_spec.rb
index d0f9c70c4e..5de70d6db0 100644
--- a/spec/ruby/library/socket/socket/listen_spec.rb
+++ b/spec/ruby/library/socket/socket/listen_spec.rb
@@ -35,7 +35,7 @@ describe 'Socket#listen' do
end
it 'raises Errno::EOPNOTSUPP' do
- lambda { @server.listen(1) }.should raise_error(Errno::EOPNOTSUPP)
+ -> { @server.listen(1) }.should raise_error(Errno::EOPNOTSUPP)
end
end
@@ -57,7 +57,7 @@ describe 'Socket#listen' do
end
it "raises when the given argument can't be coerced to an Integer" do
- lambda { @server.listen('cats') }.should raise_error(TypeError)
+ -> { @server.listen('cats') }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
index 5f717d4b54..94f58ac49f 100644
--- a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
+++ b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
@@ -16,7 +16,7 @@ describe 'Socket#recvfrom_nonblock' do
platform_is_not :windows do
describe 'using an unbound socket' do
it 'raises IO::WaitReadable' do
- lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
+ -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
end
end
end
@@ -29,7 +29,7 @@ describe 'Socket#recvfrom_nonblock' do
describe 'without any data available' do
it 'raises IO::WaitReadable' do
- lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
+ -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
end
it 'returns :wait_readable with exception: false' do
diff --git a/spec/ruby/library/socket/socket/recvfrom_spec.rb b/spec/ruby/library/socket/socket/recvfrom_spec.rb
index 7f0714511c..faf161e4a5 100644
--- a/spec/ruby/library/socket/socket/recvfrom_spec.rb
+++ b/spec/ruby/library/socket/socket/recvfrom_spec.rb
@@ -15,7 +15,7 @@ describe 'Socket#recvfrom' do
describe 'using an unbound socket' do
it 'blocks the caller' do
- lambda { @server.recvfrom(1) }.should block_caller
+ -> { @server.recvfrom(1) }.should block_caller
end
end
@@ -27,7 +27,7 @@ describe 'Socket#recvfrom' do
describe 'without any data available' do
it 'blocks the caller' do
- lambda { @server.recvfrom(1) }.should block_caller
+ -> { @server.recvfrom(1) }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/socket/sysaccept_spec.rb b/spec/ruby/library/socket/socket/sysaccept_spec.rb
index f039096707..92ac21124e 100644
--- a/spec/ruby/library/socket/socket/sysaccept_spec.rb
+++ b/spec/ruby/library/socket/socket/sysaccept_spec.rb
@@ -15,7 +15,7 @@ describe 'Socket#sysaccept' do
platform_is :linux do # hangs on other platforms
describe 'using an unbound socket' do
it 'raises Errno::EINVAL' do
- lambda { @server.sysaccept }.should raise_error(Errno::EINVAL)
+ -> { @server.sysaccept }.should raise_error(Errno::EINVAL)
end
end
@@ -25,7 +25,7 @@ describe 'Socket#sysaccept' do
end
it 'raises Errno::EINVAL' do
- lambda { @server.sysaccept }.should raise_error(Errno::EINVAL)
+ -> { @server.sysaccept }.should raise_error(Errno::EINVAL)
end
end
end
@@ -59,8 +59,6 @@ describe 'Socket#sysaccept' do
@client.connect(@server_addr)
- thread.join(5)
-
thread.value.should be_an_instance_of(Array)
end
end
diff --git a/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb b/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb
index 05ecad67d1..a46c6df5c6 100644
--- a/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb
+++ b/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb
@@ -4,7 +4,7 @@ require_relative '../fixtures/classes'
describe 'Socket.tcp_server_loop' do
describe 'when no connections are available' do
it 'blocks the caller' do
- lambda { Socket.tcp_server_loop('127.0.0.1', 0) }.should block_caller
+ -> { Socket.tcp_server_loop('127.0.0.1', 0) }.should block_caller
end
end
@@ -45,7 +45,7 @@ describe 'Socket.tcp_server_loop' do
# At this point the connection has been set up but the thread may not yet
# have returned, thus we'll need to wait a little longer for it to
# complete.
- thread.join(2)
+ thread.join
@sock.should be_an_instance_of(Socket)
addr.should be_an_instance_of(Addrinfo)
diff --git a/spec/ruby/library/socket/socket/tcp_spec.rb b/spec/ruby/library/socket/socket/tcp_spec.rb
index 29f166ffc5..d36e3e6adb 100644
--- a/spec/ruby/library/socket/socket/tcp_spec.rb
+++ b/spec/ruby/library/socket/socket/tcp_spec.rb
@@ -49,7 +49,7 @@ describe 'Socket.tcp' do
end
it 'raises ArgumentError when 6 arguments are provided' do
- lambda {
+ -> {
Socket.tcp(@host, @port, @host, 0, {:connect_timeout => 1}, 10)
}.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb b/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb
index 1cb82d72be..cb8c5c5587 100644
--- a/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb
+++ b/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb
@@ -13,7 +13,7 @@ describe 'Socket.udp_server_loop_on' do
describe 'when no connections are available' do
it 'blocks the caller' do
- lambda { Socket.udp_server_loop_on([@server]) }.should block_caller
+ -> { Socket.udp_server_loop_on([@server]) }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/socket/udp_server_loop_spec.rb b/spec/ruby/library/socket/socket/udp_server_loop_spec.rb
index 168c17545f..66563bc742 100644
--- a/spec/ruby/library/socket/socket/udp_server_loop_spec.rb
+++ b/spec/ruby/library/socket/socket/udp_server_loop_spec.rb
@@ -4,7 +4,7 @@ require_relative '../fixtures/classes'
describe 'Socket.udp_server_loop' do
describe 'when no connections are available' do
it 'blocks the caller' do
- lambda { Socket.udp_server_loop('127.0.0.1', 0) }.should block_caller
+ -> { Socket.udp_server_loop('127.0.0.1', 0) }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/socket/unix_server_loop_spec.rb b/spec/ruby/library/socket/socket/unix_server_loop_spec.rb
index a2d2ad9fdb..0f34d4a50b 100644
--- a/spec/ruby/library/socket/socket/unix_server_loop_spec.rb
+++ b/spec/ruby/library/socket/socket/unix_server_loop_spec.rb
@@ -13,7 +13,7 @@ with_feature :unix_socket do
describe 'when no connections are available' do
it 'blocks the caller' do
- lambda { Socket.unix_server_loop(@path) }.should block_caller
+ -> { Socket.unix_server_loop(@path) }.should block_caller
end
end
@@ -48,7 +48,7 @@ with_feature :unix_socket do
end
end
- thread.join(2)
+ thread.join
@sock.should be_an_instance_of(Socket)
addr.should be_an_instance_of(Addrinfo)
diff --git a/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb b/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb
index 579ae307df..79ec68cd18 100644
--- a/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb
+++ b/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb
@@ -35,12 +35,12 @@ describe "Socket.unpack_sockaddr_in" do
with_feature :unix_socket do
it "raises an ArgumentError when the sin_family is not AF_INET" do
sockaddr = Socket.sockaddr_un '/tmp/x'
- lambda { Socket.unpack_sockaddr_in sockaddr }.should raise_error(ArgumentError)
+ -> { Socket.unpack_sockaddr_in sockaddr }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when passed addrinfo is not AF_INET/AF_INET6" do
addrinfo = Addrinfo.unix('/tmp/sock')
- lambda { Socket.unpack_sockaddr_in(addrinfo) }.should raise_error(ArgumentError)
+ -> { Socket.unpack_sockaddr_in(addrinfo) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb b/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb
index 39e33c90e9..bd95f1db08 100644
--- a/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb
+++ b/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb
@@ -15,12 +15,12 @@ with_feature :unix_socket do
it 'raises an ArgumentError when the sin_family is not AF_UNIX' do
sockaddr = Socket.sockaddr_in(0, '127.0.0.1')
- lambda { Socket.unpack_sockaddr_un(sockaddr) }.should raise_error(ArgumentError)
+ -> { Socket.unpack_sockaddr_un(sockaddr) }.should raise_error(ArgumentError)
end
it 'raises an ArgumentError when passed addrinfo is not AF_UNIX' do
addrinfo = Addrinfo.tcp('127.0.0.1', 0)
- lambda { Socket.unpack_sockaddr_un(addrinfo) }.should raise_error(ArgumentError)
+ -> { Socket.unpack_sockaddr_un(addrinfo) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb b/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb
index 6f118026ae..91f6a327f0 100644
--- a/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb
@@ -13,7 +13,7 @@ describe "Socket::TCPServer.accept_nonblock" do
it "accepts non blocking connections" do
@server.listen(5)
- lambda {
+ -> {
@server.accept_nonblock
}.should raise_error(IO::WaitReadable)
@@ -33,12 +33,12 @@ describe "Socket::TCPServer.accept_nonblock" do
it "raises an IOError if the socket is closed" do
@server.close
- lambda { @server.accept }.should raise_error(IOError)
+ -> { @server.accept }.should raise_error(IOError)
end
describe 'without a connected client' do
it 'raises error' do
- lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
end
it 'returns :wait_readable in exceptionless mode' do
@@ -59,7 +59,7 @@ describe 'TCPServer#accept_nonblock' do
describe 'without a connected client' do
it 'raises IO::WaitReadable' do
- lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
end
end
diff --git a/spec/ruby/library/socket/tcpserver/accept_spec.rb b/spec/ruby/library/socket/tcpserver/accept_spec.rb
index f0ef9cc727..0da4e2218b 100644
--- a/spec/ruby/library/socket/tcpserver/accept_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/accept_spec.rb
@@ -60,7 +60,7 @@ describe "TCPServer#accept" do
it "raises an IOError if the socket is closed" do
@server.close
- lambda { @server.accept }.should raise_error(IOError)
+ -> { @server.accept }.should raise_error(IOError)
end
end
@@ -76,7 +76,7 @@ describe 'TCPServer#accept' do
describe 'without a connected client' do
it 'blocks the caller' do
- lambda { @server.accept }.should block_caller
+ -> { @server.accept }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/tcpserver/gets_spec.rb b/spec/ruby/library/socket/tcpserver/gets_spec.rb
index 936295dce2..417976d737 100644
--- a/spec/ruby/library/socket/tcpserver/gets_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/gets_spec.rb
@@ -11,6 +11,6 @@ describe "TCPServer#gets" do
end
it "raises Errno::ENOTCONN on gets" do
- lambda { @server.gets }.should raise_error(Errno::ENOTCONN)
+ -> { @server.gets }.should raise_error(Errno::ENOTCONN)
end
end
diff --git a/spec/ruby/library/socket/tcpserver/initialize_spec.rb b/spec/ruby/library/socket/tcpserver/initialize_spec.rb
index 412bdbfb9d..4ddd1f465f 100644
--- a/spec/ruby/library/socket/tcpserver/initialize_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/initialize_spec.rb
@@ -52,7 +52,7 @@ describe 'TCPServer#initialize' do
describe 'with a single String argument containing a non numeric value' do
it 'raises SocketError' do
- lambda { TCPServer.new('cats') }.should raise_error(SocketError)
+ -> { TCPServer.new('cats') }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/tcpserver/listen_spec.rb b/spec/ruby/library/socket/tcpserver/listen_spec.rb
index e266decd61..c877fdced6 100644
--- a/spec/ruby/library/socket/tcpserver/listen_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/listen_spec.rb
@@ -16,7 +16,7 @@ describe 'TCPServer#listen' do
end
it "raises when the given argument can't be coerced to an Integer" do
- lambda { @server.listen('cats') }.should raise_error(TypeError)
+ -> { @server.listen('cats') }.should raise_error(TypeError)
end
end
end
diff --git a/spec/ruby/library/socket/tcpserver/new_spec.rb b/spec/ruby/library/socket/tcpserver/new_spec.rb
index 4717b95a2c..94e5744995 100644
--- a/spec/ruby/library/socket/tcpserver/new_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/new_spec.rb
@@ -49,7 +49,7 @@ describe "TCPServer.new" do
end
it "coerces port to string, then determines port from that number or service name" do
- lambda { TCPServer.new(SocketSpecs.hostname, Object.new) }.should raise_error(TypeError)
+ -> { TCPServer.new(SocketSpecs.hostname, Object.new) }.should raise_error(TypeError)
port = Object.new
port.should_receive(:to_str).and_return("0")
@@ -63,7 +63,7 @@ describe "TCPServer.new" do
end
it "raises Errno::EADDRNOTAVAIL when the address is unknown" do
- lambda { TCPServer.new("1.2.3.4", 0) }.should raise_error(Errno::EADDRNOTAVAIL)
+ -> { TCPServer.new("1.2.3.4", 0) }.should raise_error(Errno::EADDRNOTAVAIL)
end
# There is no way to make this fail-proof on all machines, because
@@ -71,7 +71,7 @@ describe "TCPServer.new" do
# traditionally invalidly named ones.
quarantine! do
it "raises a SocketError when the host is unknown" do
- lambda {
+ -> {
TCPServer.new("--notavalidname", 0)
}.should raise_error(SocketError)
end
@@ -79,7 +79,7 @@ describe "TCPServer.new" do
it "raises Errno::EADDRINUSE when address is already in use" do
@server = TCPServer.new('127.0.0.1', 0)
- lambda {
+ -> {
@server = TCPServer.new('127.0.0.1', @server.addr[1])
}.should raise_error(Errno::EADDRINUSE)
end
diff --git a/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb b/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb
index 5543b67755..bd7d33faf4 100644
--- a/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb
+++ b/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb
@@ -12,7 +12,7 @@ describe "TCPServer#sysaccept" do
end
it 'blocks if no connections' do
- lambda { @server.sysaccept }.should block_caller
+ -> { @server.sysaccept }.should block_caller
end
it 'returns file descriptor of an accepted connection' do
@@ -41,7 +41,7 @@ describe 'TCPServer#sysaccept' do
describe 'without a connected client' do
it 'blocks the caller' do
- lambda { @server.sysaccept }.should block_caller
+ -> { @server.sysaccept }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/tcpsocket/initialize_spec.rb b/spec/ruby/library/socket/tcpsocket/initialize_spec.rb
index a3593f0d5f..a3cee05412 100644
--- a/spec/ruby/library/socket/tcpsocket/initialize_spec.rb
+++ b/spec/ruby/library/socket/tcpsocket/initialize_spec.rb
@@ -5,7 +5,7 @@ describe 'TCPSocket#initialize' do
SocketSpecs.each_ip_protocol do |family, ip_address|
describe 'when no server is listening on the given address' do
it 'raises Errno::ECONNREFUSED' do
- lambda { TCPSocket.new(ip_address, 666) }.should raise_error(Errno::ECONNREFUSED)
+ -> { TCPSocket.new(ip_address, 666) }.should raise_error(Errno::ECONNREFUSED)
end
end
@@ -31,7 +31,7 @@ describe 'TCPSocket#initialize' do
end
it 'raises SocketError when the port number is a non numeric String' do
- lambda { TCPSocket.new(ip_address, 'cats') }.should raise_error(SocketError)
+ -> { TCPSocket.new(ip_address, 'cats') }.should raise_error(SocketError)
end
it 'set the socket to binmode' do
diff --git a/spec/ruby/library/socket/tcpsocket/shared/new.rb b/spec/ruby/library/socket/tcpsocket/shared/new.rb
index d0358923c9..5ca3a0e6cc 100644
--- a/spec/ruby/library/socket/tcpsocket/shared/new.rb
+++ b/spec/ruby/library/socket/tcpsocket/shared/new.rb
@@ -3,11 +3,11 @@ require_relative '../../fixtures/classes'
describe :tcpsocket_new, shared: true do
it "requires a hostname and a port as arguments" do
- lambda { TCPSocket.send(@method) }.should raise_error(ArgumentError)
+ -> { TCPSocket.send(@method) }.should raise_error(ArgumentError)
end
it "refuses the connection when there is no server to connect to" do
- lambda do
+ -> do
TCPSocket.send(@method, SocketSpecs.hostname, SocketSpecs.reserved_unused_port)
end.should raise_error(SystemCallError) {|e|
[Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL].should include(e.class)
diff --git a/spec/ruby/library/socket/udpsocket/bind_spec.rb b/spec/ruby/library/socket/udpsocket/bind_spec.rb
index 4dbdb285f6..08b386e941 100644
--- a/spec/ruby/library/socket/udpsocket/bind_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/bind_spec.rb
@@ -18,7 +18,7 @@ describe "UDPSocket#bind" do
it "raises Errno::EINVAL when already bound" do
@socket.bind(SocketSpecs.hostname, 0)
- lambda {
+ -> {
@socket.bind(SocketSpecs.hostname, @socket.addr[1])
}.should raise_error(Errno::EINVAL)
end
diff --git a/spec/ruby/library/socket/udpsocket/new_spec.rb b/spec/ruby/library/socket/udpsocket/new_spec.rb
index 157ff138be..6cc0cadbcb 100644
--- a/spec/ruby/library/socket/udpsocket/new_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/new_spec.rb
@@ -27,7 +27,7 @@ describe 'UDPSocket.new' do
end
it 'raises Errno::EAFNOSUPPORT or Errno::EPROTONOSUPPORT if unsupported family passed' do
- lambda { UDPSocket.new(-1) }.should raise_error(SystemCallError) { |e|
+ -> { UDPSocket.new(-1) }.should raise_error(SystemCallError) { |e|
[Errno::EAFNOSUPPORT, Errno::EPROTONOSUPPORT].should include(e.class)
}
end
diff --git a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
index fb88a2dc13..c66d1df84d 100644
--- a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
@@ -16,7 +16,7 @@ describe 'UDPSocket#recvfrom_nonblock' do
platform_is_not :windows do
describe 'using an unbound socket' do
it 'raises IO::WaitReadable' do
- lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
+ -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
end
end
end
@@ -32,7 +32,7 @@ describe 'UDPSocket#recvfrom_nonblock' do
describe 'without any data available' do
it 'raises IO::WaitReadable' do
- lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
+ -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable)
end
it 'returns :wait_readable with exception: false' do
diff --git a/spec/ruby/library/socket/udpsocket/send_spec.rb b/spec/ruby/library/socket/udpsocket/send_spec.rb
index 431129723e..5d5de684af 100644
--- a/spec/ruby/library/socket/udpsocket/send_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/send_spec.rb
@@ -66,7 +66,7 @@ describe "UDPSocket#send" do
it "raises EMSGSIZE if data is too too big" do
@socket = UDPSocket.open
begin
- lambda do
+ -> do
@socket.send('1' * 100_000, 0, SocketSpecs.hostname, @port.to_s)
end.should raise_error(Errno::EMSGSIZE)
ensure
@@ -96,7 +96,7 @@ describe 'UDPSocket#send' do
describe 'using a disconnected socket' do
describe 'without a destination address' do
it "raises #{SocketSpecs.dest_addr_req_error}" do
- lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
@@ -108,7 +108,7 @@ describe 'UDPSocket#send' do
it 'does not persist the connection after sending data' do
@client.send('hello', 0, @addr.ip_address, @addr.ip_port)
- lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
+ -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error)
end
end
@@ -144,7 +144,7 @@ describe 'UDPSocket#send' do
it 'sends the data to the given address instead' do
@client.send('hello', 0, @alt_server.getsockname).should == 5
- lambda { @server.recv(5) }.should block_caller
+ -> { @server.recv(5) }.should block_caller
@alt_server.recv(5).should == 'hello'
end
diff --git a/spec/ruby/library/socket/udpsocket/write_spec.rb b/spec/ruby/library/socket/udpsocket/write_spec.rb
index e960de1baf..c971f29b62 100644
--- a/spec/ruby/library/socket/udpsocket/write_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/write_spec.rb
@@ -10,7 +10,7 @@ describe "UDPSocket#write" do
s2 = UDPSocket.new
s2.connect(host, s1.addr[1])
- lambda do
+ -> do
s2.write('1' * 100_000)
end.should raise_error(Errno::EMSGSIZE)
ensure
diff --git a/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb b/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb
index 3ebe38a090..30688b46b6 100644
--- a/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb
+++ b/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb
@@ -49,7 +49,7 @@ with_feature :unix_socket do
describe 'without a client' do
it 'raises IO::WaitReadable' do
- lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
+ -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable)
end
end
diff --git a/spec/ruby/library/socket/unixserver/accept_spec.rb b/spec/ruby/library/socket/unixserver/accept_spec.rb
index a1570f7013..c05fbe7f22 100644
--- a/spec/ruby/library/socket/unixserver/accept_spec.rb
+++ b/spec/ruby/library/socket/unixserver/accept_spec.rb
@@ -74,7 +74,7 @@ with_feature :unix_socket do
describe 'without a client' do
it 'blocks the calling thread' do
- lambda { @server.accept }.should block_caller
+ -> { @server.accept }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/unixserver/initialize_spec.rb b/spec/ruby/library/socket/unixserver/initialize_spec.rb
index cb186ceb76..0cc49ef1eb 100644
--- a/spec/ruby/library/socket/unixserver/initialize_spec.rb
+++ b/spec/ruby/library/socket/unixserver/initialize_spec.rb
@@ -22,7 +22,7 @@ with_feature :unix_socket do
end
it 'raises Errno::EADDRINUSE when the socket is already in use' do
- lambda { UNIXServer.new(@path) }.should raise_error(Errno::EADDRINUSE)
+ -> { UNIXServer.new(@path) }.should raise_error(Errno::EADDRINUSE)
end
end
end
diff --git a/spec/ruby/library/socket/unixserver/sysaccept_spec.rb b/spec/ruby/library/socket/unixserver/sysaccept_spec.rb
index 65a35c91a9..e59731878a 100644
--- a/spec/ruby/library/socket/unixserver/sysaccept_spec.rb
+++ b/spec/ruby/library/socket/unixserver/sysaccept_spec.rb
@@ -16,7 +16,7 @@ with_feature :unix_socket do
describe 'without a client' do
it 'blocks the calling thread' do
- lambda { @server.sysaccept }.should block_caller
+ -> { @server.sysaccept }.should block_caller
end
end
diff --git a/spec/ruby/library/socket/unixsocket/initialize_spec.rb b/spec/ruby/library/socket/unixsocket/initialize_spec.rb
index a6217d404f..13b6972f03 100644
--- a/spec/ruby/library/socket/unixsocket/initialize_spec.rb
+++ b/spec/ruby/library/socket/unixsocket/initialize_spec.rb
@@ -5,7 +5,7 @@ with_feature :unix_socket do
describe 'UNIXSocket#initialize' do
describe 'using a non existing path' do
it 'raises Errno::ENOENT' do
- lambda { UNIXSocket.new(SocketSpecs.socket_path) }.should raise_error(Errno::ENOENT)
+ -> { UNIXSocket.new(SocketSpecs.socket_path) }.should raise_error(Errno::ENOENT)
end
end
diff --git a/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb b/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb
index e39c8a0570..0b6b1ccf04 100644
--- a/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb
+++ b/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb
@@ -21,7 +21,7 @@ describe "UNIXSocket#peeraddr" do
end
it "raises an error in server sockets" do
- lambda {
+ -> {
@server.peeraddr
}.should raise_error(Errno::ENOTCONN)
end