Merge pull request #8632 from Matt-Yorkley/default-url-options

Set default_url_options in all environments
This commit is contained in:
Matt-Yorkley
2021-12-27 12:23:49 +00:00
committed by GitHub
5 changed files with 8 additions and 5 deletions

View File

@@ -5,3 +5,5 @@ SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
OFN_REDIS_URL="redis://localhost:6379/1"
OFN_REDIS_JOBS_URL="redis://localhost:6379/2"
SITE_URL="0.0.0.0:3000"

View File

@@ -2,3 +2,5 @@
# Override locally with `.env.test.local`
SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
SITE_URL="test.host"

View File

@@ -45,7 +45,7 @@ module Openfoodnetwork
config.after_initialize do
# We need this here because the test env file loads before the Spree engine is loaded
Spree::Core::Engine.routes.default_url_options[:host] = 'test.host' if Rails.env == 'test'
Spree::Core::Engine.routes.default_url_options[:host] = ENV["SITE_URL"] if Rails.env == 'test'
end
# We reload the routes here
@@ -230,6 +230,8 @@ module Openfoodnetwork
config.generators.template_engine = :haml
Rails.application.routes.default_url_options[:host] = ENV["SITE_URL"]
config.autoloader = :zeitwerk
config.action_view.form_with_generates_ids = true

View File

@@ -52,6 +52,3 @@ Openfoodnetwork::Application.configure do
config.active_job.queue_adapter = :test
end
# Allows us to use _url helpers in Rspec
Rails.application.routes.default_url_options[:host] = 'test.host'

View File

@@ -46,7 +46,7 @@ Capybara.configure do |config|
end
# Override setting in Spree engine: Spree::Core::MailSettings
ActionMailer::Base.default_url_options[:host] = 'test.host'
ActionMailer::Base.default_url_options[:host] = ENV["SITE_URL"]
FactoryBot.use_parent_strategy = false