Skip to content

Commit e654752

Browse files
ta1kt0mebenoittgt
authored andcommitted
Make puma log silence completely
1 parent 76e7a55 commit e654752

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

features/system_specs/system_specs.feature

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Feature: System spec
2525
javascript, you do not need [DatabaseCleaner](https://github.com/DatabaseCleaner/database_cleaner).
2626

2727
@system_test
28-
Scenario: System specs
28+
Scenario: System specs driven by rack_test
2929
Given a file named "spec/system/widget_system_spec.rb" with:
3030
"""ruby
3131
require "rails_helper"
@@ -81,3 +81,29 @@ Feature: System spec
8181
"""
8282
When I run `rspec spec/system/some_job_system_spec.rb`
8383
Then the example should pass
84+
85+
@system_test
86+
Scenario: System specs driven by selenium_chrome_headless
87+
Given a file named "spec/system/widget_system_spec.rb" with:
88+
"""ruby
89+
require "rails_helper"
90+
91+
RSpec.describe "Widget management", :type => :system do
92+
before do
93+
driven_by(:selenium_chrome_headless)
94+
end
95+
96+
it "enables me to create widgets" do
97+
visit "/widgets/new"
98+
99+
fill_in "Name", :with => "My Widget"
100+
click_button "Create Widget"
101+
102+
expect(page).to have_text("Widget was successfully created.")
103+
end
104+
end
105+
"""
106+
When I run `rspec spec/system/widget_system_spec.rb`
107+
Then the exit status should be 0
108+
And the output should contain "1 example, 0 failures"
109+
And the output should not contain "Puma starting"

lib/rspec/rails/example/system_example_group.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ def app
5050
end
5151

5252
included do |other|
53+
ActiveSupport.on_load(:action_dispatch_system_test_case) do
54+
ActionDispatch::SystemTesting::Server.silence_puma = true
55+
end
56+
5357
begin
5458
require 'capybara'
5559
require 'action_dispatch/system_test_case'
@@ -77,7 +81,7 @@ def app
7781

7882
attr_reader :driver
7983

80-
if ActionDispatch::SystemTesting::Server.respond_to?(:silence_puma=)
84+
if ::Rails.version.to_f == 5.1
8185
ActionDispatch::SystemTesting::Server.silence_puma = true
8286
end
8387

0 commit comments

Comments
 (0)