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

Add support for Rack 3 (fix "unable to connect") #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dan-jensen
Copy link
Contributor

Problem

Upgrading to Rack 3+ causes calls to Capybara::Webmock.start to fail with "RuntimeError: Unable to connect to capybara-webmock proxy on 9292" (followed by "EOFError: end of file reached" for subsequent tests in the rspec run).

That happens because this gem's config.ru file calls Rack::Handler::WEBrick, which no longer exists as of Rack 3. It has been moved to Rackup (Rackup::Handler::WEBrick).

Solution

This modifies config.ru to look for a new Rackup handler before falling back to an old Rack handler.

This uses the same syntax used in capybara since 2023-10-08.

We missed the deprecation period because the warnings emitted in stdout don't get displayed. Likewise, now this is raising an error, we can't see the error messages. I found the problem by adding puts stdout.read and discovering the error message.

Handler definitions have moved from Rack to Rackup in Rack 3. This
modifies config.ru to look for a new Rackup handler before falling
back to an old Rack handler.
@dan-jensen
Copy link
Contributor Author

@dillonhafer @avogel3 could one of you guys review and merge?

This one is more critical than other pending PRs because it fixes a problem that is difficult to trace back to capybara-webmock after upgrading to Rack 3. Thankfully it's a simple fix, so hopefully a quick review and merge if you have a minute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant