Move test setup to application.rb

Without spree_core, the test environment file loads before the Spree engine is loaded
This commit is contained in:
Luis Ramos
2020-09-27 00:31:20 +01:00
parent 5c4ea1a6be
commit f6f4faf146
2 changed files with 5 additions and 1 deletions

View File

@@ -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

View File

@@ -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'