From: Kevin Clark Date: Wed, 18 Jun 2008 01:14:08 +0000 (+0000) Subject: Add failing spec for Socket closing when it has an error (THRIFT-7) X-Git-Tag: 0.2.0~564 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=f98286a8e4bf02df06f8c821d2a36b6254b77bb5;p=common%2Fthrift.git Add failing spec for Socket closing when it has an error (THRIFT-7) git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668986 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/rb/spec/socket_spec.rb b/lib/rb/spec/socket_spec.rb index a98d6220..249d2a83 100644 --- a/lib/rb/spec/socket_spec.rb +++ b/lib/rb/spec/socket_spec.rb @@ -66,6 +66,15 @@ class ThriftSocketSpec < Spec::ExampleGroup @handle.should_receive(:recv).with(17).and_return("test data") @socket.read(17).should == "test data" end + + it "should declare itself as closed when it has an error" 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 end describe ServerSocket do