Merge pull request #31384 from rails/dont-override-server
Change the system tests to set Puma as default server only when the user haven't specified manually another server.
This commit is contained in:
commit
1b24fb213b
@ -1,3 +1,8 @@
|
||||
* Changed the system tests to set Puma as default server only when the
|
||||
user haven't specified manually another server.
|
||||
|
||||
*Guillermo Iguaran*
|
||||
|
||||
* Add secure `X-Download-Options` and `X-Permitted-Cross-Domain-Policies` to
|
||||
default headers set.
|
||||
|
||||
|
@ -20,7 +20,7 @@ def setup
|
||||
end
|
||||
|
||||
def set_server
|
||||
Capybara.server = :puma, { Silent: self.class.silence_puma }
|
||||
Capybara.server = :puma, { Silent: self.class.silence_puma } if Capybara.server == Capybara.servers[:default]
|
||||
end
|
||||
|
||||
def set_port
|
||||
|
@ -6,10 +6,27 @@
|
||||
|
||||
class ServerTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
ActionDispatch::SystemTesting::Server.new.run
|
||||
@old_capybara_server = Capybara.server
|
||||
end
|
||||
|
||||
test "port is always included" do
|
||||
ActionDispatch::SystemTesting::Server.new.run
|
||||
assert Capybara.always_include_port, "expected Capybara.always_include_port to be true"
|
||||
end
|
||||
|
||||
test "server is changed from `default` to `puma`" do
|
||||
Capybara.server = :default
|
||||
ActionDispatch::SystemTesting::Server.new.run
|
||||
refute_equal Capybara.server, Capybara.servers[:default]
|
||||
end
|
||||
|
||||
test "server is not changed to `puma` when is different than default" do
|
||||
Capybara.server = :webrick
|
||||
ActionDispatch::SystemTesting::Server.new.run
|
||||
assert_equal Capybara.server, Capybara.servers[:webrick]
|
||||
end
|
||||
|
||||
teardown do
|
||||
Capybara.server = @old_capybara_server
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user