1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Improve error message when Puma isn't available

This commit is contained in:
Thomas Walpole 2018-04-06 10:54:31 -07:00
parent 8f115d94e0
commit 6f48859a60
2 changed files with 13 additions and 1 deletions

View file

@ -1,5 +1,13 @@
# Upgrading from Capybara 2.x to 3.x
## Server
Capybara 3 changes the default server to <a href="https://github.com/puma/puma">Puma</a>. If you do not use `Puma` in your project you can
revert to the previous default of WEBRick by specifying
```ruby
Capybara.server = :webrick
```
## Finders

View file

@ -438,7 +438,11 @@ Capybara.register_server :webrick do |app, port, host, **options|
end
Capybara.register_server :puma do |app, port, host, **options|
require 'rack/handler/puma'
begin
require 'rack/handler/puma'
rescue LoadError
raise LoadError, "Capybara is unable to load `puma` for its server, please add `puma` to your project or specify a different server via something like `Capybara.server = :webrick`."
end
# If we just run the Puma Rack handler it installs signal handlers which prevent us from being able to interrupt tests.
# Therefore construct and run the Server instance ourselves.
# Rack::Handler::Puma.run(app, { Host: host, Port: port, Threads: "0:4", workers: 0, daemon: false }.merge(options))