def open
begin
- addrinfo = ::Socket::getaddrinfo(@host, @port).first
+ addrinfo = ::Socket::getaddrinfo(@host, @port, nil, ::Socket::SOCK_STREAM).first
@handle = ::Socket.new(addrinfo[4], ::Socket::SOCK_STREAM, 0)
sockaddr = ::Socket.sockaddr_in(addrinfo[1], addrinfo[3])
begin
@handle
end
end
-end
\ No newline at end of file
+end
it "should open a ::Socket with default args" do
::Socket.should_receive(:new).and_return(mock("Handle", :connect_nonblock => true))
- ::Socket.should_receive(:getaddrinfo).with("localhost", 9090).and_return([[]])
+ ::Socket.should_receive(:getaddrinfo).with("localhost", 9090, nil, ::Socket::SOCK_STREAM).and_return([[]])
::Socket.should_receive(:sockaddr_in)
@socket.open
end
it "should accept host/port options" do
::Socket.should_receive(:new).and_return(mock("Handle", :connect_nonblock => true))
- ::Socket.should_receive(:getaddrinfo).with("my.domain", 1234).and_return([[]])
+ ::Socket.should_receive(:getaddrinfo).with("my.domain", 1234, nil, ::Socket::SOCK_STREAM).and_return([[]])
::Socket.should_receive(:sockaddr_in)
Socket.new('my.domain', 1234).open
end