From 4d8c44d890571ceeb2fdbcbfe2823d0e622c5972 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 13 Apr 2022 15:03:38 +1000 Subject: [PATCH] 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. --- spec/system/support/cuprite_setup.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/system/support/cuprite_setup.rb b/spec/system/support/cuprite_setup.rb index f75d42b7b0..07a42e7039 100644 --- a/spec/system/support/cuprite_setup.rb +++ b/spec/system/support/cuprite_setup.rb @@ -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