Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Set host name as well as Capybara root options

Oliver Güntherc8625ee5a856
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index fcc63cf2e96..364cee17513 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -5,10 +5,12 @@ require 'capybara-screenshot/rspec'
require 'rack_session_access/capybara'
require 'action_dispatch'
-RSpec.shared_context 'with default_url_options set' do
+RSpec.shared_context 'with default_url_options and host name set to Capybara test server' do
before do
@original_host = default_url_options[:host]
@original_port = default_url_options[:port]
+ @original_host_setting = Setting.host_name
+ Setting.host_name = "#{Capybara.server_host}:#{Capybara.server_port}"
default_url_options[:host] = Capybara.server_host
default_url_options[:port] = Capybara.server_port
end
@@ -16,6 +18,7 @@ RSpec.shared_context 'with default_url_options set' do
after do
default_url_options[:host] = @original_host # rubocop:disable RSpec/InstanceVariable
default_url_options[:port] = @original_port # rubocop:disable RSpec/InstanceVariable
+ Setting.host_name = @original_host_setting
end
end
@@ -39,7 +42,7 @@ RSpec.configure do |config|
end
# Set the default options
- config.include_context 'with default_url_options set', type: :feature
+ config.include_context 'with default_url_options and host name set to Capybara test server', type: :feature
# Make it possible to match on value attribute.
#