THRIFT-4358: add unix domain socket option to ruby cross tests
Client: rb
This closes #1513
diff --git a/lib/rb/spec/socket_spec.rb b/lib/rb/spec/socket_spec.rb
index 8e1ef50..df56ba5 100644
--- a/lib/rb/spec/socket_spec.rb
+++ b/lib/rb/spec/socket_spec.rb
@@ -43,6 +43,7 @@
::Socket.should_receive(:new).and_return(mock("Handle", :connect_nonblock => true, :setsockopt => nil))
::Socket.should_receive(:getaddrinfo).with("localhost", 9090, nil, ::Socket::SOCK_STREAM).and_return([[]])
::Socket.should_receive(:sockaddr_in)
+ @socket.to_s == "socket(localhost:9090)"
@socket.open
end
@@ -50,12 +51,18 @@
::Socket.should_receive(:new).and_return(mock("Handle", :connect_nonblock => true, :setsockopt => nil))
::Socket.should_receive(:getaddrinfo).with("my.domain", 1234, nil, ::Socket::SOCK_STREAM).and_return([[]])
::Socket.should_receive(:sockaddr_in)
- Thrift::Socket.new('my.domain', 1234).open
+ @socket = Thrift::Socket.new('my.domain', 1234).open
+ @socket.to_s == "socket(my.domain:1234)"
end
it "should accept an optional timeout" do
::Socket.stub!(:new)
Thrift::Socket.new('localhost', 8080, 5).timeout.should == 5
end
+
+ it "should provide a reasonable to_s" do
+ ::Socket.stub!(:new)
+ Thrift::Socket.new('myhost', 8090).to_s.should == "socket(myhost:8090)"
+ end
end
end