Pass fully qualified constants to #setsockopt

Fixes #396.
This commit is contained in:
Matthew Horan 2012-11-22 14:20:58 -05:00
parent f4732768cc
commit e80a9c8b92
2 changed files with 2 additions and 2 deletions

View File

@ -113,7 +113,7 @@ module Capybara::Webkit
def attempt_connect
@socket = @socket_class.open("127.0.0.1", @port)
if defined?(Socket::TCP_NODELAY)
@socket.setsockopt(:IPPROTO_TCP, :TCP_NODELAY, 1)
@socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)
end
rescue Errno::ECONNREFUSED
end

View File

@ -38,7 +38,7 @@ describe Capybara::Webkit::Connection do
socket = stub('socket')
TCPSocket.stub(:open).and_return(socket)
if defined?(Socket::TCP_NODELAY)
socket.should_receive(:setsockopt).with(:IPPROTO_TCP, :TCP_NODELAY, 1)
socket.should_receive(:setsockopt).with(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)
else
socket.should_not_receive(:setsockopt)
end