diff --git a/config/application.rb b/config/application.rb index 0dfdf138f4..ad890e0b2e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,6 +23,11 @@ module Openfoodnetwork end end + 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' + end + initializer "spree.environment", before: :load_config_initializers do |app| app.config.spree = Spree::Core::Environment.new Spree::Config = app.config.spree.preferences # legacy access diff --git a/config/environments/test.rb b/config/environments/test.rb index f33423acdd..d6ea342589 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -55,4 +55,3 @@ end # Allows us to use _url helpers in Rspec Rails.application.routes.default_url_options[:host] = 'test.host' -Spree::Core::Engine.routes.default_url_options[:host] = 'test.host'