2012-05-04 15:50:30 -04:00
|
|
|
require 'spec_helper'
|
2012-07-08 15:17:08 -04:00
|
|
|
require 'capybara/webkit/connection'
|
2012-05-04 15:50:30 -04:00
|
|
|
|
2012-07-08 15:17:08 -04:00
|
|
|
describe Capybara::Webkit::Connection do
|
2016-04-05 17:18:14 -04:00
|
|
|
it "sets appropriate options on its socket" do
|
|
|
|
socket = double("socket")
|
|
|
|
server = double(:Server, start: nil, port: 123)
|
2017-02-03 14:20:27 -05:00
|
|
|
allow(TCPSocket).to receive(:open).and_return(socket)
|
2012-07-16 10:52:10 -04:00
|
|
|
if defined?(Socket::TCP_NODELAY)
|
2017-02-03 14:20:27 -05:00
|
|
|
expect(socket).to receive(:setsockopt).
|
2016-04-05 17:18:14 -04:00
|
|
|
with(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)
|
2012-07-16 10:52:10 -04:00
|
|
|
else
|
2017-02-03 14:20:27 -05:00
|
|
|
expect(socket).not_to receive(:setsockopt)
|
2012-07-16 10:52:10 -04:00
|
|
|
end
|
|
|
|
|
2016-04-05 17:18:14 -04:00
|
|
|
Capybara::Webkit::Connection.new(server: server)
|
2012-05-04 15:50:30 -04:00
|
|
|
end
|
|
|
|
end
|