From e6379bc2ab5cdfc59af89929adca641faa9d4eb0 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 10 Dec 2020 10:17:26 +0100 Subject: [PATCH] Maintenance: Ensure that FQDN Setting has correct host and port value in Capybara system test context. --- spec/support/capybara/driven_by.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/support/capybara/driven_by.rb b/spec/support/capybara/driven_by.rb index 04b681c90..bbac911c3 100644 --- a/spec/support/capybara/driven_by.rb +++ b/spec/support/capybara/driven_by.rb @@ -3,8 +3,15 @@ require_relative './set_up' RSpec.configure do |config| config.before(:each, type: :system) do - # start a silenced Puma as application server - Capybara.server = :puma, { Silent: true, Host: '0.0.0.0', Threads: '0:16' } + Capybara.register_server :puma_wrapper do |app, port, host, **_options| + + # update fqdn Setting according to random assigned Rack server port + Setting.set('fqdn', "#{host}:#{port}") + + # start a silenced Puma as application server + Capybara.servers[:puma].call(app, port, host, { Silent: true, Host: '0.0.0.0', Threads: '0:16' }) + end + Capybara.server = :puma_wrapper # set the Host from gather container IP for CI runs if ENV['CI'].present?