mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00

* Other ruby implementations use the spec/ruby directory. [Misc #13792] [ruby-core:82287] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
43 lines
1.1 KiB
Ruby
43 lines
1.1 KiB
Ruby
require File.expand_path('../../../../spec_helper', __FILE__)
|
|
require File.expand_path('../../fixtures/classes', __FILE__)
|
|
|
|
describe "Socket::BasicSocket#close_read" do
|
|
before :each do
|
|
@server = TCPServer.new(0)
|
|
end
|
|
|
|
after :each do
|
|
@server.close unless @server.closed?
|
|
end
|
|
|
|
it "closes the reading end of the socket" do
|
|
@server.close_read
|
|
lambda { @server.read }.should raise_error(IOError)
|
|
end
|
|
|
|
it "it works on sockets with closed ends" do
|
|
@server.close_read
|
|
lambda { @server.close_read }.should_not raise_error(Exception)
|
|
lambda { @server.read }.should raise_error(IOError)
|
|
end
|
|
|
|
it "does not close the socket" do
|
|
@server.close_read
|
|
@server.closed?.should be_false
|
|
end
|
|
|
|
it "fully closes the socket if it was already closed for writing" do
|
|
@server.close_write
|
|
@server.close_read
|
|
@server.closed?.should be_true
|
|
end
|
|
|
|
it "raises IOError on closed socket" do
|
|
@server.close
|
|
lambda { @server.close_read }.should raise_error(IOError)
|
|
end
|
|
|
|
it "returns nil" do
|
|
@server.close_read.should be_nil
|
|
end
|
|
end
|