Add a few accessors and specs to prepare for the upcoming NonblockingServer
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668995 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/spec/socket_spec.rb b/lib/rb/spec/socket_spec.rb
index 5406453..b6e2a14 100644
--- a/lib/rb/spec/socket_spec.rb
+++ b/lib/rb/spec/socket_spec.rb
@@ -29,9 +29,9 @@
TCPSocket.should_receive(:new).and_return(@handle)
@socket.open
@socket.should be_open
- @socket.set_handle nil
+ @socket.handle = nil
@socket.should_not be_open
- @socket.set_handle @handle
+ @socket.handle = @handle
@handle.should_receive(:close)
@socket.close
@socket.should_not be_open
@@ -85,8 +85,8 @@
end
it "should create a handle when calling listen" do
- TCPServer.should_receive(:new).with(nil, 1234)
@socket.listen
+ @socket.handle.should be_an_instance_of(TCPServer)
end
it "should create a Thrift::Socket to wrap accepted sockets" do
@@ -97,7 +97,7 @@
handle.should_receive(:accept).and_return(sock)
trans = mock("Socket")
Socket.should_receive(:new).and_return(trans)
- trans.should_receive(:set_handle).with(sock)
+ trans.should_receive(:handle=).with(sock)
@socket.accept.should == trans
end