Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rackup removed its dependency on webrick #2785

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions capybara.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('selenium-webdriver', ['~>4.8'])
s.add_development_dependency('sinatra', ['>= 1.4.0'])
s.add_development_dependency('uglifier')
s.add_development_dependency('webrick')
s.add_development_dependency('yard', ['>= 0.9.0'])

if RUBY_ENGINE == 'rbx'
Expand Down
15 changes: 12 additions & 3 deletions lib/capybara/registrations/servers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@
rescue LoadError
# Rack 3 separated out the webrick handle - no way test currently in Capybaras automated
# tests due to Sinatra not yet supporting Rack 3 - experimental
require 'rackup/handler/webrick'
Rackup
begin
# Rackup 2.2.0 has removed its dependency on webrick. The user
# must add it to their bundle themselves.
verbose, $VERBOSE = $VERBOSE, nil
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This supresses the warning that ruby would produce

require 'rackup/handler/webrick'
Rackup
rescue LoadError
raise LoadError, 'Capybara is unable to load `webrick` for its server, please add `webrick` to your project or specify a different server.'
ensure
$VERBOSE = verbose
end
end
options = { Host: host, Port: port, AccessLog: [], Logger: WEBrick::Log.new(nil, 0) }.merge(options)
base_class::Handler::WEBrick.run(app, **options)
Expand All @@ -26,7 +35,7 @@
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`.'
raise LoadError, 'Capybara is unable to load `puma` for its server, please add `puma` to your project or specify a different server.'
end
puma_rack_handler = defined?(Rackup::Handler::Puma) ? Rackup::Handler::Puma : Rack::Handler::Puma

Expand Down