summaryrefslogtreecommitdiff
path: root/spec/ruby/library/socket/udpsocket/new_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/socket/udpsocket/new_spec.rb')
-rw-r--r--spec/ruby/library/socket/udpsocket/new_spec.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/spec/ruby/library/socket/udpsocket/new_spec.rb b/spec/ruby/library/socket/udpsocket/new_spec.rb
index 6cc0cadbcb..aff111927c 100644
--- a/spec/ruby/library/socket/udpsocket/new_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/new_spec.rb
@@ -8,27 +8,33 @@ 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
+ -> {
+ @socket = UDPSocket.new { raise }
+ }.should complain(/warning: UDPSocket::new\(\) does not take block; use UDPSocket::open\(\) instead/)
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