1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00
capybara-webkit/spec/connection_spec.rb
Joe Ferris 753348ecb4 Extract class for booting the server
The Connection class is fairly large and combines the responsibilities
of booting the server and connecting to it.

This extracts a class to encapsulate booting a server. It also provides
a hook for injecting your own server.
2016-04-07 13:10:20 -04:00

19 lines
552 B
Ruby

require 'spec_helper'
require 'capybara/webkit/connection'
describe Capybara::Webkit::Connection do
it "sets appropriate options on its socket" do
socket = double("socket")
server = double(:Server, start: nil, port: 123)
TCPSocket.stub(:open).and_return(socket)
if defined?(Socket::TCP_NODELAY)
socket.
should_receive(:setsockopt).
with(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)
else
socket.should_not_receive(:setsockopt)
end
Capybara::Webkit::Connection.new(server: server)
end
end