rb: Add spec to ensure UNIXServerSocket deletes the socket when closing
authorKevin Clark <kclark@apache.org>
Wed, 18 Jun 2008 01:18:57 +0000 (01:18 +0000)
committerKevin Clark <kclark@apache.org>
Wed, 18 Jun 2008 01:18:57 +0000 (01:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@669023 13f79535-47bb-0310-9956-ffa450edef68

lib/rb/spec/unixsocket_spec.rb

index 777ef04..abc166a 100644 (file)
@@ -50,6 +50,16 @@ class ThriftUNIXSocketSpec < Spec::ExampleGroup
       UNIXServer.should_receive(:new).with(@path).and_return(handle)
       @socket.listen
       handle.should_receive(:close)
+      File.stub!(:delete)
+      @socket.close
+    end
+
+    it "should delete the socket when closed" do
+      handle = mock("UNIXServer", :closed? => false)
+      UNIXServer.should_receive(:new).with(@path).and_return(handle)
+      @socket.listen
+      handle.stub!(:close)
+      File.should_receive(:delete).with(@path)
       @socket.close
     end