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

Silence Puma's startup messages in JS specs #981

Conversation

gabebw
Copy link
Contributor

@gabebw gabebw commented Jun 19, 2019

When Capybara starts the first JavaScript spec of a run, it starts Puma
and prints out the Puma startup messages:

Capybara starting Puma...
* Version 3.12.1 , codename: Llamas in Pajamas
* Min threads: 0, max threads: 4
* Listening on tcp://127.0.0.1:62516

By setting Silent: true, we can prevent those messages from being printed.

A bit of background: rspec/rspec-rails#1897

Proof that Capybara uses Puma as its default server: https://github.com/teamcapybara/capybara/blob/3.24.0/lib/capybara.rb#L247-L249

@@ -8,8 +8,12 @@ def add_gems
Bundler.with_clean_env { run "bundle install" }
end

def configure_chromedriver
def configure_capybara
Copy link
Contributor Author

@gabebw gabebw Jun 19, 2019

Choose a reason for hiding this comment

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

I thought this new name made more sense, but I'm happy to revert this change.

copy_file "chromedriver.rb", "spec/support/chromedriver.rb"
copy_file(
"capybara_silence_puma.rb",
"spec/support/capybara_silence_puma.rb"
Copy link

Choose a reason for hiding this comment

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

Style/TrailingCommaInArguments: Put a comma after the last parameter of a multiline method call.

When Capybara starts the first JavaScript spec of a run, it starts Puma
and prints out the Puma startup messages:

    Capybara starting Puma...
    * Version 3.12.1 , codename: Llamas in Pajamas
    * Min threads: 0, max threads: 4
    * Listening on tcp://127.0.0.1:62516

By setting `Silent: true`, we can prevent those messages from being
printed.

A bit of background: rspec/rspec-rails#1897

Proof that Capybara uses Puma as its default server: https://github.com/teamcapybara/capybara/blob/3.24.0/lib/capybara.rb#L247-L249
@gabebw gabebw force-pushed the gbw-silence-puma-startup-messages-in-JS-specs branch from a217a57 to 368ca7f Compare June 19, 2019 07:22
@composerinteralia
Copy link
Contributor

I like it!

@composerinteralia composerinteralia merged commit 5d7fc35 into thoughtbot:master Jun 21, 2019
@gabebw gabebw deleted the gbw-silence-puma-startup-messages-in-JS-specs branch June 27, 2019 00:59
cpjmcquillan added a commit to cpjmcquillan/suspenders that referenced this pull request May 18, 2023
Capybara was configured to silence Puma in thoughtbot#981 to prevent Puma startup messages
being output when running specs with `js: true`.

This configuration has since been updated in
[rspec-rails](rspec/rspec-rails#2289), so we can remove
it here.
stevepolitodesign pushed a commit that referenced this pull request May 27, 2023
Capybara was configured to silence Puma in #981 to prevent Puma startup messages
being output when running specs with `js: true`.

This configuration has since been updated in
[rspec-rails](rspec/rspec-rails#2289), so we can remove
it here.
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.

2 participants