mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@875a09e
This commit is contained in:
parent
a06301b103
commit
5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue