Skip to content

Fix puma loading in Rails 5.1 #1884

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

Merged
merged 4 commits into from
Oct 18, 2017
Merged

Fix puma loading in Rails 5.1 #1884

merged 4 commits into from
Oct 18, 2017

Conversation

fables-tales
Copy link
Member

No description provided.

@JonRowe
Copy link
Member

JonRowe commented Oct 17, 2017

This LGTM @samphippen, merge on green and get out a bugfix :)

@fables-tales fables-tales merged commit 2055f32 into master Oct 18, 2017
fables-tales pushed a commit that referenced this pull request Oct 18, 2017
* Fix puma loading in Rails 5.1

* Prevent system tests loading without capybara

* Allow rescuing exceptions for system test

* Fix rubocop lints
@JonRowe JonRowe deleted the fix-puma-loading branch October 18, 2017 22:23
@guilleiguaran
Copy link

guilleiguaran commented Oct 29, 2017

If I understand this PR correctly it's disabling entirely system tests entirely if Puma is not present because it's a hard requirement for system tests in Rails 5.1, right?

IMO Puma should be the default for System tests but not a hard requirement and we must allow the use of alternatives. I'll try to improve this on Rails side to make this work even when puma gem isn't present (making Puma the default but allowing the use alternative servers as WebRick and Unicorn for SystemTestCase)

We aren't requiring to Puma gem directly in SystemTestCase anymore: rails/rails@50f6976

and Puma is set as default server through Capybara.server: https://github.com/rails/rails/blob/50f697664edf0d2deff22f3f1a1c8e01d54a74ca/actionpack/lib/action_dispatch/system_testing/server.rb#L23, in this way puma gem isn't required until it's used by Capybara.

I'll create a test app with rails master and rspec 3.7.0 to check if the error persists and hopefully, we can backport this to 5.1.x

@guilleiguaran
Copy link

I've created a test app with rails master, rspec 3.7.0, added a system spec and removed puma gem and after of setting in spec_helper.rb:

config.before(:suite)   { Capybara.server = :webrick }

The spec worked as expected.

@JonRowe
Copy link
Member

JonRowe commented Oct 31, 2017

@guilleiguaran any idea when that'll be released? And will it be a minor or patch level increment.

@ansonhoyt
Copy link

ansonhoyt commented Nov 3, 2017

@guilleiguaran thanks for this. I was just trying out a system test with Capybara.server = :passenger, and noticed the hardcoded require "rack/handler/puma" in actionpack.

A 5.1 backport would be much appreciated, as it would let my tests more closely match production.

sebjacobs pushed a commit to futurelearn/rspec-rails that referenced this pull request Mar 15, 2019
* Fix puma loading in Rails 5.1

* Prevent system tests loading without capybara

* Allow rescuing exceptions for system test

* Fix rubocop lints
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.

4 participants