Include port in URLs generated by system specs

This means that we can follow generated links, for example in emails and
reach the test app server.
This commit is contained in:
Maikel Linke
2022-04-13 15:03:38 +10:00
parent a4bffc61f1
commit 4d8c44d890

View File

@@ -34,7 +34,8 @@ RSpec.configure do |config|
# Make sure url helpers in mailers use the Capybara server host.
config.around(:each, type: :system) do |example|
original_host = Rails.application.default_url_options[:host]
Rails.application.default_url_options[:host] = Capybara.server_host
Rails.application.default_url_options[:host] =
"#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}"
example.run
Rails.application.default_url_options[:host] = original_host
end