diff options
Diffstat (limited to 'spec/ruby/library/socket/udpsocket')
9 files changed, 29 insertions, 29 deletions
diff --git a/spec/ruby/library/socket/udpsocket/bind_spec.rb b/spec/ruby/library/socket/udpsocket/bind_spec.rb index 08b386e941..974e701e71 100644 --- a/spec/ruby/library/socket/udpsocket/bind_spec.rb +++ b/spec/ruby/library/socket/udpsocket/bind_spec.rb @@ -12,7 +12,7 @@ describe "UDPSocket#bind" do it "binds the socket to a port" do @socket.bind(SocketSpecs.hostname, 0) - @socket.addr[1].should be_kind_of(Integer) + @socket.addr[1].should.is_a?(Integer) end it "raises Errno::EINVAL when already bound" do @@ -20,7 +20,7 @@ describe "UDPSocket#bind" do -> { @socket.bind(SocketSpecs.hostname, @socket.addr[1]) - }.should raise_error(Errno::EINVAL) + }.should.raise(Errno::EINVAL) end it "receives a hostname and a port" do diff --git a/spec/ruby/library/socket/udpsocket/initialize_spec.rb b/spec/ruby/library/socket/udpsocket/initialize_spec.rb index ecf0043c10..c040187400 100644 --- a/spec/ruby/library/socket/udpsocket/initialize_spec.rb +++ b/spec/ruby/library/socket/udpsocket/initialize_spec.rb @@ -7,27 +7,27 @@ describe 'UDPSocket#initialize' do it 'initializes a new UDPSocket' do @socket = UDPSocket.new - @socket.should be_an_instance_of(UDPSocket) + @socket.should.instance_of?(UDPSocket) end it 'initializes a new UDPSocket using an Integer' do @socket = UDPSocket.new(Socket::AF_INET) - @socket.should be_an_instance_of(UDPSocket) + @socket.should.instance_of?(UDPSocket) end it 'initializes a new UDPSocket using a Symbol' do @socket = UDPSocket.new(:INET) - @socket.should be_an_instance_of(UDPSocket) + @socket.should.instance_of?(UDPSocket) end it 'initializes a new UDPSocket using a String' do @socket = UDPSocket.new('INET') - @socket.should be_an_instance_of(UDPSocket) + @socket.should.instance_of?(UDPSocket) end it 'sets the socket to binmode' do @socket = UDPSocket.new(:INET) - @socket.binmode?.should be_true + @socket.binmode?.should == true end platform_is_not :windows do @@ -46,8 +46,8 @@ describe 'UDPSocket#initialize' do it 'raises Errno::EAFNOSUPPORT or Errno::EPROTONOSUPPORT when given an invalid address family' do -> { UDPSocket.new(666) - }.should raise_error(SystemCallError) { |e| - [Errno::EAFNOSUPPORT, Errno::EPROTONOSUPPORT].should include(e.class) + }.should.raise(SystemCallError) { |e| + [Errno::EAFNOSUPPORT, Errno::EPROTONOSUPPORT].should.include?(e.class) } end end diff --git a/spec/ruby/library/socket/udpsocket/local_address_spec.rb b/spec/ruby/library/socket/udpsocket/local_address_spec.rb index 92e4cc10c7..868d2f537e 100644 --- a/spec/ruby/library/socket/udpsocket/local_address_spec.rb +++ b/spec/ruby/library/socket/udpsocket/local_address_spec.rb @@ -28,7 +28,7 @@ describe 'UDPSocket#local_address' do end it 'returns an Addrinfo' do - @sock.local_address.should be_an_instance_of(Addrinfo) + @sock.local_address.should.instance_of?(Addrinfo) end describe 'the returned Addrinfo' do diff --git a/spec/ruby/library/socket/udpsocket/new_spec.rb b/spec/ruby/library/socket/udpsocket/new_spec.rb index 79bfcb624d..aff111927c 100644 --- a/spec/ruby/library/socket/udpsocket/new_spec.rb +++ b/spec/ruby/library/socket/udpsocket/new_spec.rb @@ -8,22 +8,22 @@ describe 'UDPSocket.new' do it 'without arguments' do @socket = UDPSocket.new - @socket.should be_an_instance_of(UDPSocket) + @socket.should.instance_of?(UDPSocket) end it 'using Integer argument' do @socket = UDPSocket.new(Socket::AF_INET) - @socket.should be_an_instance_of(UDPSocket) + @socket.should.instance_of?(UDPSocket) end it 'using Symbol argument' do @socket = UDPSocket.new(:INET) - @socket.should be_an_instance_of(UDPSocket) + @socket.should.instance_of?(UDPSocket) end it 'using String argument' do @socket = UDPSocket.new('INET') - @socket.should be_an_instance_of(UDPSocket) + @socket.should.instance_of?(UDPSocket) end it "does not use the given block and warns to use UDPSocket::open" do @@ -33,8 +33,8 @@ describe 'UDPSocket.new' do end it 'raises Errno::EAFNOSUPPORT or Errno::EPROTONOSUPPORT if unsupported family passed' do - -> { UDPSocket.new(-1) }.should raise_error(SystemCallError) { |e| - [Errno::EAFNOSUPPORT, Errno::EPROTONOSUPPORT].should include(e.class) + -> { UDPSocket.new(-1) }.should.raise(SystemCallError) { |e| + [Errno::EAFNOSUPPORT, Errno::EPROTONOSUPPORT].should.include?(e.class) } end end diff --git a/spec/ruby/library/socket/udpsocket/open_spec.rb b/spec/ruby/library/socket/udpsocket/open_spec.rb index e4dbb2ee2a..7c77855372 100644 --- a/spec/ruby/library/socket/udpsocket/open_spec.rb +++ b/spec/ruby/library/socket/udpsocket/open_spec.rb @@ -8,6 +8,6 @@ describe "UDPSocket.open" do it "allows calls to open without arguments" do @socket = UDPSocket.open - @socket.should be_kind_of(UDPSocket) + @socket.should.is_a?(UDPSocket) end end diff --git a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb index b804099589..460cf2c9a2 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 - -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable) + -> { @server.recvfrom_nonblock(1) }.should.raise(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 - -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable) + -> { @server.recvfrom_nonblock(1) }.should.raise(IO::WaitReadable) end it 'returns :wait_readable with exception: false' do @@ -48,7 +48,7 @@ describe 'UDPSocket#recvfrom_nonblock' do it 'returns an Array containing the data and an Array' do IO.select([@server]) - @server.recvfrom_nonblock(1).should be_an_instance_of(Array) + @server.recvfrom_nonblock(1).should.instance_of?(Array) end it 'writes the data to the buffer when one is present' do @@ -78,7 +78,7 @@ describe 'UDPSocket#recvfrom_nonblock' do end it 'contains an Array at index 1' do - @array[1].should be_an_instance_of(Array) + @array[1].should.instance_of?(Array) end end diff --git a/spec/ruby/library/socket/udpsocket/remote_address_spec.rb b/spec/ruby/library/socket/udpsocket/remote_address_spec.rb index 94889ce560..d1310200fc 100644 --- a/spec/ruby/library/socket/udpsocket/remote_address_spec.rb +++ b/spec/ruby/library/socket/udpsocket/remote_address_spec.rb @@ -28,7 +28,7 @@ describe 'UDPSocket#remote_address' do end it 'returns an Addrinfo' do - @sock.remote_address.should be_an_instance_of(Addrinfo) + @sock.remote_address.should.instance_of?(Addrinfo) end describe 'the returned Addrinfo' do diff --git a/spec/ruby/library/socket/udpsocket/send_spec.rb b/spec/ruby/library/socket/udpsocket/send_spec.rb index 6dd5f67bea..63f5b0dcc6 100644 --- a/spec/ruby/library/socket/udpsocket/send_spec.rb +++ b/spec/ruby/library/socket/udpsocket/send_spec.rb @@ -34,7 +34,7 @@ describe "UDPSocket#send" do @msg[0].should == "ad hoc" @msg[1][0].should == "AF_INET" - @msg[1][1].should be_kind_of(Integer) + @msg[1][1].should.is_a?(Integer) @msg[1][3].should == "127.0.0.1" end @@ -46,7 +46,7 @@ describe "UDPSocket#send" do @msg[0].should == "ad hoc" @msg[1][0].should == "AF_INET" - @msg[1][1].should be_kind_of(Integer) + @msg[1][1].should.is_a?(Integer) @msg[1][3].should == "127.0.0.1" end @@ -59,7 +59,7 @@ describe "UDPSocket#send" do @msg[0].should == "connection-based" @msg[1][0].should == "AF_INET" - @msg[1][1].should be_kind_of(Integer) + @msg[1][1].should.is_a?(Integer) @msg[1][3].should == "127.0.0.1" end @@ -68,7 +68,7 @@ describe "UDPSocket#send" do begin -> do @socket.send('1' * 100_000, 0, SocketSpecs.hostname, @port.to_s) - end.should raise_error(Errno::EMSGSIZE) + end.should.raise(Errno::EMSGSIZE) ensure @socket.send("ad hoc", 0, SocketSpecs.hostname, @port) @socket.close @@ -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 - -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error) + -> { @client.send('hello', 0) }.should.raise(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) - -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error) + -> { @client.send('hello', 0) }.should.raise(SocketSpecs.dest_addr_req_error) end end diff --git a/spec/ruby/library/socket/udpsocket/write_spec.rb b/spec/ruby/library/socket/udpsocket/write_spec.rb index c971f29b62..d41ee078d8 100644 --- a/spec/ruby/library/socket/udpsocket/write_spec.rb +++ b/spec/ruby/library/socket/udpsocket/write_spec.rb @@ -12,7 +12,7 @@ describe "UDPSocket#write" do -> do s2.write('1' * 100_000) - end.should raise_error(Errno::EMSGSIZE) + end.should.raise(Errno::EMSGSIZE) ensure s1.close if s1 && !s1.closed? s2.close if s2 && !s2.closed? |
