Extract method to generate app host in tests

On JavaScript tests, Rails URL methods don't include the port when
invoked from a test, but they do when invoked from the browser. This was
causing some tests to fail with Selenium.
This commit is contained in:
Javi Martín
2021-03-24 18:24:04 +01:00
parent b93f38ec11
commit 8ed09adcaf
4 changed files with 28 additions and 26 deletions

View File

@@ -34,7 +34,7 @@ end
Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
"goog:chromeOptions" => {
args: %W[headless no-sandbox window-size=1200,800 proxy-server=127.0.0.1:#{Capybara::Webmock.port_number}]
args: %W[headless no-sandbox window-size=1200,800 proxy-server=#{Capybara.app_host}:#{Capybara::Webmock.port_number}]
}
)