Tidy up (consolidate) setting of the "domain" in dev and test environments

This commit is contained in:
Matt-Yorkley
2021-11-23 18:34:43 +00:00
parent 750411fd15
commit b813acdab3
5 changed files with 6 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

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