aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorSam Phippen <samphippen@googlemail.com>2017-06-24 15:47:59 -0400
committerSam Phippen <samphippen@googlemail.com>2017-06-24 15:47:59 -0400
commiteba361824d9eb242f186bb711ef82381ac50ef9e (patch)
tree3cfceae220ee6201dc009af02917571c1235e7f4 /actionpack
parent8cad811b0559661df3c58528ac1e8d5a2e601d4d (diff)
downloadrails-eba361824d9eb242f186bb711ef82381ac50ef9e.tar.gz
rails-eba361824d9eb242f186bb711ef82381ac50ef9e.tar.bz2
rails-eba361824d9eb242f186bb711ef82381ac50ef9e.zip
Add an option to silence puma in system tests.
This is motivated by our usage of system test in RSpec. Puma lazily boots the first time a system test is used, but this causes some unfortunate output to appear in the middle of the user's green dots. An example of this can be seen in @derekprior's comment [here](https://github.com/rspec/rspec-rails/pull/1813#issuecomment-309252314). There are alternatives in RSpec where we attempt to intercept the puma boot and prevent the output from being made there, but that would involve some monkey patching. This seems like a cleaner solution.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/system_testing/server.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/system_testing/server.rb b/actionpack/lib/action_dispatch/system_testing/server.rb
index 4a214ef713..89ca6944d9 100644
--- a/actionpack/lib/action_dispatch/system_testing/server.rb
+++ b/actionpack/lib/action_dispatch/system_testing/server.rb
@@ -3,6 +3,12 @@ require "rack/handler/puma"
module ActionDispatch
module SystemTesting
class Server # :nodoc:
+ class << self
+ attr_accessor :silence_puma
+ end
+
+ self.silence_puma = false
+
def run
register
setup
@@ -11,7 +17,12 @@ module ActionDispatch
private
def register
Capybara.register_server :rails_puma do |app, port, host|
- Rack::Handler::Puma.run(app, Port: port, Threads: "0:1")
+ Rack::Handler::Puma.run(
+ app,
+ Port: port,
+ Threads: "0:1",
+ Silent: self.class.silence_puma
+ )
end
end