mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
753348ecb4
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.
19 lines
552 B
Ruby
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
|