You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by kc...@apache.org on 2008/06/18 03:14:08 UTC

svn commit: r668986 - /incubator/thrift/trunk/lib/rb/spec/socket_spec.rb

Author: kclark
Date: Tue Jun 17 18:14:08 2008
New Revision: 668986

URL: http://svn.apache.org/viewvc?rev=668986&view=rev
Log:
Add failing spec for Socket closing when it has an error (THRIFT-7)

Modified:
    incubator/thrift/trunk/lib/rb/spec/socket_spec.rb

Modified: incubator/thrift/trunk/lib/rb/spec/socket_spec.rb
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/socket_spec.rb?rev=668986&r1=668985&r2=668986&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/spec/socket_spec.rb (original)
+++ incubator/thrift/trunk/lib/rb/spec/socket_spec.rb Tue Jun 17 18:14:08 2008
@@ -66,6 +66,15 @@
       @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