rb: Thrift::Socket should return false from #open? if an error occurred during a read/write (THRIFT-7)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@669000 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/spec/socket_spec.rb b/lib/rb/spec/socket_spec.rb
index 4d129b0..4f5868b 100644
--- a/lib/rb/spec/socket_spec.rb
+++ b/lib/rb/spec/socket_spec.rb
@@ -6,6 +6,7 @@
before(:each) do
@socket = Socket.new
@handle = mock("Handle")
+ @handle.stub!(:close)
end
describe Socket do
@@ -68,14 +69,12 @@
end
it "should declare itself as closed when it has an error" do
- pending do
- TCPSocket.should_receive(:new).and_return(@handle)
- @socket.open
- @handle.should_receive(:write).with("fail").and_raise(StandardError)
- @socket.should be_open
- lambda { @socket.write("fail") }.should raise_error
- @socket.should_not be_open
- end
+ TCPSocket.should_receive(:new).and_return(@handle)
+ @socket.open
+ @handle.should_receive(:write).with("fail").and_raise(StandardError)
+ @socket.should be_open
+ lambda { @socket.write("fail") }.should raise_error
+ @socket.should_not be_open
end
end