diff --git a/core/lib/spree/testing_support/factories/shipping_method_factory.rb b/core/lib/spree/testing_support/factories/shipping_method_factory.rb index da40ddbdfeb..6d1be504a8b 100644 --- a/core/lib/spree/testing_support/factories/shipping_method_factory.rb +++ b/core/lib/spree/testing_support/factories/shipping_method_factory.rb @@ -23,7 +23,7 @@ transient do cost 10.0 - currency 'USD' + currency { Spree::Config[:currency] } end before(:create) do |shipping_method, _evaluator| diff --git a/core/spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb b/core/spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb index 6ed287ccbfb..d830e6377b3 100644 --- a/core/spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb +++ b/core/spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb @@ -13,6 +13,15 @@ shipping_method = create(factory) expect(shipping_method.calculator.calculable).to eq(shipping_method) end + + context 'store using alternate currency' do + before { Spree::Config[:currency] = 'CAD' } + + it "should configure the calculator correctly" do + shipping_method = create(factory) + expect(shipping_method.calculator.preferences[:currency]).to eq('CAD') + end + end end describe 'base shipping method' do