DEV: Add CAPYBARA_SERVER_HOST (#23475)

Why this change?

When running in a Docker container, we want to bind the Rails server
started by Capybara to 0.0.0.0 instead of localhost. This is done via
the `server_host` config for Capybara which can now be configured via
the `CAPYBARA_SERVER_HOST` env.
This commit is contained in:
Alan Guo Xiang Tan 2023-09-08 11:16:48 +08:00 committed by GitHub
parent ef73d20832
commit 6beed147cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,7 +308,7 @@ RSpec.configure do |config|
Capybara.w3c_click_offset = false
Capybara.configure do |capybara_config|
capybara_config.server_host = "localhost"
capybara_config.server_host = ENV["CAPYBARA_SERVER_HOST"].presence || "localhost"
capybara_config.server_port = 31_337 + ENV["TEST_ENV_NUMBER"].to_i
end