Skip to content

Instantly share code, notes, and snippets.

@barrettkingram
Created December 30, 2020 14:48
Show Gist options
  • Save barrettkingram/d806d85ef3f2f03b15932711786ffec1 to your computer and use it in GitHub Desktop.
Save barrettkingram/d806d85ef3f2f03b15932711786ffec1 to your computer and use it in GitHub Desktop.
Configuration to use unicorn with capybara
Capybara.register_server :unicorn do |app, port, host, **options|
rackup_opts = Unicorn::Configurator::RACKUP
rackup_opts[:host] = host
rackup_opts[:port] = port
rackup_opts[:set_listener] = true
server = Unicorn::HttpServer.new(app, rackup_opts[:options])
server.logger.level = :warn
at_exit do
trap(:CHLD, nil)
server.stop(false)
end
server.start.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment