Skip to content

Commit

Permalink
Silence Puma's startup messages in JS specs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gabebw authored and composerinteralia committed Jun 21, 2019
1 parent ef250e2 commit 5d7fc35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/suspenders/generators/js_driver_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ def add_gems
Bundler.with_clean_env { run "bundle install" }
end

def configure_chromedriver
def configure_capybara
copy_file "chromedriver.rb", "spec/support/chromedriver.rb"
copy_file(
"capybara_silence_puma.rb",
"spec/support/capybara_silence_puma.rb",
)
end
end
end
1 change: 1 addition & 0 deletions templates/capybara_silence_puma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Capybara.server = :puma, { Silent: true }

0 comments on commit 5d7fc35

Please sign in to comment.