2012-05-04 19:50:30 +00:00
|
|
|
require 'spec_helper'
|
2012-07-08 19:17:08 +00:00
|
|
|
require 'capybara/webkit/connection'
|
2012-05-04 19:50:30 +00:00
|
|
|
|
2012-07-08 19:17:08 +00:00
|
|
|
describe Capybara::Webkit::Connection do
|
2016-04-05 21:18:14 +00:00
|
|
|
it "sets appropriate options on its socket" do
|
|
|
|
socket = double("socket")
|
|
|
|
server = double(:Server, start: nil, port: 123)
|
2012-08-10 17:30:34 +00:00
|
|
|
TCPSocket.stub(:open).and_return(socket)
|
2012-07-16 14:52:10 +00:00
|
|
|
if defined?(Socket::TCP_NODELAY)
|
2016-04-05 21:18:14 +00:00
|
|
|
socket.
|
|
|
|
should_receive(:setsockopt).
|
|
|
|
with(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)
|
2012-07-16 14:52:10 +00:00
|
|
|
else
|
2012-08-10 17:30:34 +00:00
|
|
|
socket.should_not_receive(:setsockopt)
|
2012-07-16 14:52:10 +00:00
|
|
|
end
|
|
|
|
|
2016-04-05 21:18:14 +00:00
|
|
|
Capybara::Webkit::Connection.new(server: server)
|
2012-05-04 19:50:30 +00:00
|
|
|
end
|
|
|
|
end
|