From 23706ec1d6a1bcf4aa5022e72bc7ddc5477f4eac Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 14 Aug 2020 13:01:51 +1000 Subject: [PATCH] Load our version of the Spree environment We didn't actually change any logic in our version of the Spree environment file but if we do that in the future, we want to be sure that it takes effect. Our file was ignored and not loaded before. --- config/initializers/spree.rb | 1 + spec/lib/spree/core/environment_spec.rb | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 spec/lib/spree/core/environment_spec.rb diff --git a/config/initializers/spree.rb b/config/initializers/spree.rb index 6ff230c5f5..2e80f978ae 100644 --- a/config/initializers/spree.rb +++ b/config/initializers/spree.rb @@ -6,6 +6,7 @@ # In order to initialize a setting do: # config.setting_name = 'new value' +require "spree/core/environment" require 'spree/product_filters' # Due to a bug in ActiveRecord we need to load the tagging code in Gateway which diff --git a/spec/lib/spree/core/environment_spec.rb b/spec/lib/spree/core/environment_spec.rb new file mode 100644 index 0000000000..7eec8dc329 --- /dev/null +++ b/spec/lib/spree/core/environment_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Spree::Core::Environment do + # Our version doesn't add any features we could test. + # So we just check that our file is loaded correctly. + let(:our_file) { Rails.root.join("lib/spree/core/environment.rb").to_s } + + it "is defined in our code" do + file = subject.method(:initialize).source_location.first + expect(file).to eq our_file + end + + it "used by Spree" do + file = Spree::Core::Engine.config.spree.method(:initialize).source_location.first + expect(file).to eq our_file + end +end