Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Deprecate `Spree::Config[:currency']`

Damian Legawiec170a680e602c
diff --git a/api/spec/spec_helper.rb b/api/spec/spec_helper.rb
index d4d2cc1fd5..b5096df58c 100644
--- a/api/spec/spec_helper.rb
+++ b/api/spec/spec_helper.rb
@@ -70,9 +70,7 @@ RSpec.configure do |config|
Spree::Api::Config[:requires_authentication] = true
country = create(:country, name: 'United States of America', iso_name: 'UNITED STATES', iso: 'US', states_required: true)
- Spree::Config[:default_country_id] = country.id
-
- create(:store, default: true)
+ create(:store, default: true, default_country: country, default_currency: 'USD')
end
# Force jobs to be executed in a synchronous way (see http://archive.today/xcb1E)
diff --git a/core/app/helpers/spree/currency_helper.rb b/core/app/helpers/spree/currency_helper.rb
index cc55ac1aa5..2e354683ef 100644
--- a/core/app/helpers/spree/currency_helper.rb
+++ b/core/app/helpers/spree/currency_helper.rb
@@ -1,7 +1,7 @@
module Spree
module CurrencyHelper
def currency_options(selected_value = nil)
- selected_value ||= Spree::Config[:currency]
+ selected_value ||= Spree::Store.default.default_currency
currencies = ::Money::Currency.table.map do |_code, details|
iso = details[:iso_code]
[iso, "#{details[:name]} (#{iso})"]
diff --git a/core/app/models/concerns/spree/default_price.rb b/core/app/models/concerns/spree/default_price.rb
index 0409cc9479..19528ef0e3 100644
--- a/core/app/models/concerns/spree/default_price.rb
+++ b/core/app/models/concerns/spree/default_price.rb
@@ -4,7 +4,7 @@ module Spree
included do
has_one :default_price,
- -> { with_deleted.where(currency: Spree::Config[:currency]) },
+ -> { with_deleted.where(currency: Spree::Store.default.default_currency) },
class_name: 'Spree::Price',
dependent: :destroy
diff --git a/core/app/models/concerns/spree/product_scopes.rb b/core/app/models/concerns/spree/product_scopes.rb
index b72fe9aeec..5caceb5cd1 100644
--- a/core/app/models/concerns/spree/product_scopes.rb
+++ b/core/app/models/concerns/spree/product_scopes.rb
@@ -245,7 +245,7 @@ module Spree
scope = not_discontinued.where("#{Product.quoted_table_name}.available_on <= ?", available_on)
unless Spree::Config.show_products_without_price
- currency ||= Spree::Config[:currency]
+ currency ||= Spree::Store.default.default_currency
scope = scope.with_currency(currency)
end
diff --git a/core/app/models/spree/app_configuration.rb b/core/app/models/spree/app_configuration.rb
index f707fb2218..6d73241b06 100644
--- a/core/app/models/spree/app_configuration.rb
+++ b/core/app/models/spree/app_configuration.rb
@@ -41,7 +41,7 @@ module Spree
preference :binary_inventory_cache, :boolean, default: false # only invalidate product cache when a stock item changes whether it is in_stock
preference :checkout_zone, :string, default: nil # replace with the name of a zone if you would like to limit the countries
preference :company, :boolean, default: false # Request company field for billing and shipping addr
- preference :currency, :string, default: 'USD'
+ preference :currency, :string, default: 'USD', deprecated: true
preference :default_country_id, :integer
preference :disable_sku_validation, :boolean, default: false # when turned off disables the built-in SKU uniqueness validation
preference :disable_store_presence_validation, :boolean, default: false # when turned off disables Store presence validation for Products and Payment Methods
diff --git a/core/app/models/spree/calculator/flat_rate.rb b/core/app/models/spree/calculator/flat_rate.rb
index b79757cff8..c1398b0ca9 100644
--- a/core/app/models/spree/calculator/flat_rate.rb
+++ b/core/app/models/spree/calculator/flat_rate.rb
@@ -3,7 +3,7 @@ require_dependency 'spree/calculator'
module Spree
class Calculator::FlatRate < Calculator
preference :amount, :decimal, default: 0
- preference :currency, :string, default: -> { Spree::Config[:currency] }
+ preference :currency, :string, default: -> { Spree::Store.default.default_currency }
def self.description
Spree.t(:flat_rate_per_order)
diff --git a/core/app/models/spree/calculator/flexi_rate.rb b/core/app/models/spree/calculator/flexi_rate.rb
index 5a43ac1dca..27fae73e6e 100644
--- a/core/app/models/spree/calculator/flexi_rate.rb
+++ b/core/app/models/spree/calculator/flexi_rate.rb
@@ -5,7 +5,7 @@ module Spree
preference :first_item, :decimal, default: 0.0
preference :additional_item, :decimal, default: 0.0
preference :max_items, :integer, default: 0
- preference :currency, :string, default: -> { Spree::Config[:currency] }
+ preference :currency, :string, default: -> { Spree::Store.default.default_currency }
def self.description
Spree.t(:flexible_rate)
diff --git a/core/app/models/spree/calculator/price_sack.rb b/core/app/models/spree/calculator/price_sack.rb
index 7d9a08e8c2..b9c6f29889 100644
--- a/core/app/models/spree/calculator/price_sack.rb
+++ b/core/app/models/spree/calculator/price_sack.rb
@@ -5,7 +5,7 @@ module Spree
preference :minimal_amount, :decimal, default: 0
preference :normal_amount, :decimal, default: 0
preference :discount_amount, :decimal, default: 0
- preference :currency, :string, default: -> { Spree::Config[:currency] }
+ preference :currency, :string, default: -> { Spree::Store.default.default_currency }
def self.description
Spree.t(:price_sack)
diff --git a/core/app/models/spree/calculator/shipping/digital_delivery.rb b/core/app/models/spree/calculator/shipping/digital_delivery.rb
index 2ec7a21bbc..238848cb14 100644
--- a/core/app/models/spree/calculator/shipping/digital_delivery.rb
+++ b/core/app/models/spree/calculator/shipping/digital_delivery.rb
@@ -4,7 +4,7 @@ module Spree
module Calculator::Shipping
class DigitalDelivery < ShippingCalculator
preference :amount, :decimal, default: 0
- preference :currency, :string, default: -> { Spree::Config[:currency] }
+ preference :currency, :string, default: -> { Spree::Store.default.default_currency }
def self.description
Spree.t('digital.digital_delivery')
diff --git a/core/app/models/spree/calculator/shipping/flat_rate.rb b/core/app/models/spree/calculator/shipping/flat_rate.rb
index 9e0755abcb..fcb6740648 100644
--- a/core/app/models/spree/calculator/shipping/flat_rate.rb
+++ b/core/app/models/spree/calculator/shipping/flat_rate.rb
@@ -4,7 +4,7 @@ module Spree
module Calculator::Shipping
class FlatRate < ShippingCalculator
preference :amount, :decimal, default: 0
- preference :currency, :string, default: -> { Spree::Config[:currency] }
+ preference :currency, :string, default: -> { Spree::Store.default.default_currency }
def self.description
Spree.t(:shipping_flat_rate_per_order)
diff --git a/core/app/models/spree/calculator/shipping/flexi_rate.rb b/core/app/models/spree/calculator/shipping/flexi_rate.rb
index cc43ad5695..8cc353b163 100644
--- a/core/app/models/spree/calculator/shipping/flexi_rate.rb
+++ b/core/app/models/spree/calculator/shipping/flexi_rate.rb
@@ -6,7 +6,7 @@ module Spree
preference :first_item, :decimal, default: 0.0
preference :additional_item, :decimal, default: 0.0
preference :max_items, :integer, default: 0
- preference :currency, :string, default: -> { Spree::Config[:currency] }
+ preference :currency, :string, default: -> { Spree::Store.default.default_currency }
def self.description
Spree.t(:shipping_flexible_rate)
diff --git a/core/app/models/spree/calculator/shipping/per_item.rb b/core/app/models/spree/calculator/shipping/per_item.rb
index ff5e990f74..b7fba7b5f7 100644
--- a/core/app/models/spree/calculator/shipping/per_item.rb
+++ b/core/app/models/spree/calculator/shipping/per_item.rb
@@ -4,7 +4,7 @@ module Spree
module Calculator::Shipping
class PerItem < ShippingCalculator
preference :amount, :decimal, default: 0
- preference :currency, :string, default: -> { Spree::Config[:currency] }
+ preference :currency, :string, default: -> { Spree::Store.default.default_currency }
def self.description
Spree.t(:shipping_flat_rate_per_item)
diff --git a/core/app/models/spree/calculator/shipping/price_sack.rb b/core/app/models/spree/calculator/shipping/price_sack.rb
index b55b805445..e1f51b131e 100644
--- a/core/app/models/spree/calculator/shipping/price_sack.rb
+++ b/core/app/models/spree/calculator/shipping/price_sack.rb
@@ -6,7 +6,7 @@ module Spree
preference :minimal_amount, :decimal, default: 0
preference :normal_amount, :decimal, default: 0
preference :discount_amount, :decimal, default: 0
- preference :currency, :string, default: -> { Spree::Config[:currency] }
+ preference :currency, :string, default: -> { Spree::Store.default.default_currency }
def self.description
Spree.t(:shipping_price_sack)
diff --git a/core/app/models/spree/order.rb b/core/app/models/spree/order.rb
index 76ab746c6d..3afa3dc55d 100644
--- a/core/app/models/spree/order.rb
+++ b/core/app/models/spree/order.rb
@@ -717,7 +717,7 @@ module Spree
end
def ensure_currency_presence
- self.currency ||= store.default_currency || Spree::Config[:currency]
+ self.currency ||= store.default_currency
end
def create_token
diff --git a/core/app/models/spree/price.rb b/core/app/models/spree/price.rb
index 73e3cffde0..1f012410e0 100644
--- a/core/app/models/spree/price.rb
+++ b/core/app/models/spree/price.rb
@@ -66,7 +66,7 @@ module Spree
private
def ensure_currency
- self.currency ||= Spree::Config[:currency]
+ self.currency ||= Spree::Store.default.default_currency
end
end
end
diff --git a/core/app/models/spree/return_authorization.rb b/core/app/models/spree/return_authorization.rb
index a2e1dc4baa..43c11796fc 100644
--- a/core/app/models/spree/return_authorization.rb
+++ b/core/app/models/spree/return_authorization.rb
@@ -44,7 +44,8 @@ module Spree
end
def currency
- order.nil? ? Spree::Config[:currency] : order.currency
+ # FIXME: we should associate ReturnAuthorization with Store
+ order.nil? ? Spree::Store.default.default_currency : order.currency
end
def refundable_amount
diff --git a/core/app/models/spree/return_item.rb b/core/app/models/spree/return_item.rb
index f442b87b1b..cd9522acd7 100644
--- a/core/app/models/spree/return_item.rb
+++ b/core/app/models/spree/return_item.rb
@@ -165,7 +165,7 @@ module Spree
end
def currency
- return_authorization.try(:currency) || Spree::Config[:currency]
+ return_authorization.try(:currency) || Spree::Store.default.default_currency
end
private
diff --git a/core/app/models/spree/variant.rb b/core/app/models/spree/variant.rb
index dd97b9de70..7ae937fe9f 100644
--- a/core/app/models/spree/variant.rb
+++ b/core/app/models/spree/variant.rb
@@ -93,7 +93,7 @@ module Spree
scope :not_deleted, -> { where("#{Spree::Variant.quoted_table_name}.deleted_at IS NULL") }
scope :for_currency_and_available_price_amount, ->(currency = nil) do
- currency ||= Spree::Config[:currency]
+ currency ||= Spree::Store.default.default_currency
joins(:prices).where('spree_prices.currency = ?', currency).where('spree_prices.amount IS NOT NULL').distinct
end
@@ -338,12 +338,12 @@ module Spree
self.price = product.master.price
end
if price.present? && currency.nil?
- self.currency = Spree::Config[:currency]
+ self.currency = Spree::Store.default.default_currency
end
end
def set_cost_currency
- self.cost_currency = Spree::Config[:currency] if cost_currency.blank?
+ self.cost_currency = Spree::Store.default.default_currency if cost_currency.blank?
end
def create_stock_items
diff --git a/core/lib/spree/core/controller_helpers/currency.rb b/core/lib/spree/core/controller_helpers/currency.rb
index c9599f6350..1a223a2799 100644
--- a/core/lib/spree/core/controller_helpers/currency.rb
+++ b/core/lib/spree/core/controller_helpers/currency.rb
@@ -20,7 +20,7 @@ module Spree
elsif current_store.present?
current_store.default_currency
else
- Spree::Config[:currency]
+ Spree::Store.default.default_currency
end&.upcase
end
diff --git a/core/lib/spree/money.rb b/core/lib/spree/money.rb
index 816fc5d0fd..d37542755a 100644
--- a/core/lib/spree/money.rb
+++ b/core/lib/spree/money.rb
@@ -21,7 +21,7 @@ module Spree
def initialize(amount, options = {})
use_default_currency
- @money = Monetize.parse([amount, (options[:currency] || Spree::Config[:currency])].join)
+ @money = Monetize.parse([amount, (options[:currency] || Spree::Store.default.default_currency)].join)
@options = Spree::Money.default_formatting_rules.merge(options)
end
@@ -66,7 +66,7 @@ module Spree
end
def use_default_currency
- currency = Spree::Store.default.default_currency || Spree::Config[:currency]
+ currency = Spree::Store.default.default_currency
::Money.default_currency = currency
end
diff --git a/core/lib/tasks/core.rake b/core/lib/tasks/core.rake
index 27454d517e..83df7d670c 100644
--- a/core/lib/tasks/core.rake
+++ b/core/lib/tasks/core.rake
@@ -180,7 +180,7 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
task ensure_order_currency_presence: :environment do |_t, _args|
Spree::Order.where(currency: nil).find_in_batches do |orders|
orders.each do |order|
- order.update!(currency: order.store.default_currency || Spree::Config[:currency])
+ order.update!(currency: order.store.default_currency)
end
end
end
diff --git a/core/spec/lib/search/base_spec.rb b/core/spec/lib/search/base_spec.rb
index 348d990fc8..3719dd06e0 100644
--- a/core/spec/lib/search/base_spec.rb
+++ b/core/spec/lib/search/base_spec.rb
@@ -65,7 +65,7 @@ describe Spree::Core::Search::Base do
it 'accepts multiple currencies' do
pln_price
- Spree::Config[:currency] = 'PLN'
+ Spree::Store.default.update(default_currency: 'PLN')
params_pln = { per_page: '', search: { 'price_range_any' => ['Under 10.00 zł', '10.00 zł - 15.00 zł'] } }
searcher_pln = described_class.new(ActionController::Parameters.new(params_pln))
searcher_pln.current_currency = 'PLN'
diff --git a/core/spec/lib/spree/core/importer/order_spec.rb b/core/spec/lib/spree/core/importer/order_spec.rb
index cead9c0619..7b303d020f 100644
--- a/core/spec/lib/spree/core/importer/order_spec.rb
+++ b/core/spec/lib/spree/core/importer/order_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
module Spree
module Core
describe Importer::Order do
- let(:store) { create(:store, default_country: create(:country, iso: 'US')) }
+ let(:store) { Spree::Store.default }
let!(:country) { store.default_country }
let!(:state) { country.states.first || create(:state, country: country) }
let!(:stock_location) { create(:stock_location, admin_name: 'Admin Name') }
diff --git a/core/spec/lib/spree/money_spec.rb b/core/spec/lib/spree/money_spec.rb
index 2104595cd8..0063150055 100644
--- a/core/spec/lib/spree/money_spec.rb
+++ b/core/spec/lib/spree/money_spec.rb
@@ -78,9 +78,7 @@ describe Spree::Money do
context 'JPY' do
before do
- configure_spree_preferences do |config|
- config.currency = 'JPY'
- end
+ Spree::Store.default.update(default_currency: 'JPY')
end
it 'formats correctly' do
@@ -91,9 +89,7 @@ describe Spree::Money do
context 'EUR' do
before do
- configure_spree_preferences do |config|
- config.currency = 'EUR'
- end
+ Spree::Store.default.update(default_currency: 'EUR')
end
# Regression test for #2634
diff --git a/core/spec/models/spree/adjustment_spec.rb b/core/spec/models/spree/adjustment_spec.rb
index 45ba8bf0b9..077ea99116 100644
--- a/core/spec/models/spree/adjustment_spec.rb
+++ b/core/spec/models/spree/adjustment_spec.rb
@@ -55,7 +55,7 @@ describe Spree::Adjustment, type: :model do
end
context '#save' do
- let(:order) { Spree::Order.create! }
+ let(:order) { create(:order) }
let!(:adjustment) { Spree::Adjustment.create(label: 'Adjustment', amount: 5, order: order, adjustable: order) }
it 'touches the adjustable' do
diff --git a/core/spec/models/spree/order/callbacks_spec.rb b/core/spec/models/spree/order/callbacks_spec.rb
index 73cd73716f..dbd57b8731 100644
--- a/core/spec/models/spree/order/callbacks_spec.rb
+++ b/core/spec/models/spree/order/callbacks_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Spree::Order, type: :model do
- let(:order) { stub_model(Spree::Order) }
+ let(:order) { build(:order) }
before do
Spree::Order.define_state_machine!
diff --git a/core/spec/models/spree/order/store_credit_spec.rb b/core/spec/models/spree/order/store_credit_spec.rb
index a895958ae3..cbf7ba89e3 100644
--- a/core/spec/models/spree/order/store_credit_spec.rb
+++ b/core/spec/models/spree/order/store_credit_spec.rb
@@ -214,7 +214,7 @@ describe 'Order' do
context 'the associated user has store credits' do
subject { order }
- let(:store) { create(:store) }
+ let(:store) { Spree::Store.default }
let(:store_credit) { create(:store_credit, store: store) }
let(:order) { create(:order, user: store_credit.user, store: store) }
diff --git a/core/spec/models/spree/price_spec.rb b/core/spec/models/spree/price_spec.rb
index 294162b7ab..a74deb12b6 100644
--- a/core/spec/models/spree/price_spec.rb
+++ b/core/spec/models/spree/price_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe Spree::Price, type: :model do
describe '#amount=' do
- let(:price) { Spree::Price.new }
+ let(:price) { build :price }
let(:amount) { '3,0A0' }
before do
@@ -15,7 +15,7 @@ describe Spree::Price, type: :model do
end
describe '#compare_at_amount=' do
- let(:price) { Spree::Price.new }
+ let(:price) { build :price }
let(:compare_at_amount) { '169.99' }
before do
@@ -28,7 +28,7 @@ describe Spree::Price, type: :model do
end
describe '#price' do
- let(:price) { Spree::Price.new }
+ let(:price) { build :price }
let(:amount) { 3000.00 }
context 'when amount is changed' do
@@ -43,7 +43,7 @@ describe Spree::Price, type: :model do
end
describe '#compare_at_price' do
- let(:price) { Spree::Price.new }
+ let(:price) { build :price }
let(:compare_at_amount) { 3000.00 }
context 'when amount is changed' do
@@ -58,7 +58,7 @@ describe Spree::Price, type: :model do
end
describe 'validations' do
- subject { Spree::Price.new variant: variant, amount: amount }
+ subject { build :price, variant: variant, amount: amount }
let(:variant) { stub_model Spree::Variant }
@@ -107,7 +107,7 @@ describe Spree::Price, type: :model do
let(:zone) { Spree::Zone.new }
let(:amount) { 10 }
let(:tax_category) { Spree::TaxCategory.new }
- let(:price) { Spree::Price.new variant: variant, amount: amount }
+ let(:price) { build :price, variant: variant, amount: amount }
let(:price_options) { { tax_zone: zone } }
context 'when called with a non-default zone' do
@@ -158,7 +158,7 @@ describe Spree::Price, type: :model do
let(:amount) { 10 }
let(:compare_at_amount) { 100 }
let(:tax_category) { Spree::TaxCategory.new }
- let(:price) { Spree::Price.new variant: variant, amount: amount, compare_at_amount: compare_at_amount }
+ let(:price) { build :price, variant: variant, amount: amount, compare_at_amount: compare_at_amount }
let(:price_options) { { tax_zone: zone } }
context 'when called with a non-default zone' do
@@ -201,7 +201,7 @@ describe Spree::Price, type: :model do
end
describe '#display_price_including_vat_for(zone)' do
- subject { Spree::Price.new amount: 10 }
+ subject { build :price, amount: 10 }
it 'calls #price_including_vat_for' do
expect(subject).to receive(:price_including_vat_for)
@@ -210,7 +210,7 @@ describe Spree::Price, type: :model do
end
describe '#display_compare_at_price_including_vat_for(zone)' do
- subject { Spree::Price.new amount: 10, compare_at_amount: 100 }
+ subject { build :price, amount: 10, compare_at_amount: 100 }
it 'calls #price_including_vat_for' do
expect(subject).to receive(:compare_at_price_including_vat_for)
diff --git a/core/spec/models/spree/promotion/rules/item_total_spec.rb b/core/spec/models/spree/promotion/rules/item_total_spec.rb
index d75b369629..f5bdab42e9 100644
--- a/core/spec/models/spree/promotion/rules/item_total_spec.rb
+++ b/core/spec/models/spree/promotion/rules/item_total_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper'
describe Spree::Promotion::Rules::ItemTotal, type: :model do
+ let!(:store) { create(:store, default: true) }
let(:rule) { Spree::Promotion::Rules::ItemTotal.new }
let(:order) { double(:order) }
diff --git a/core/spec/models/spree/promotion_handler/coupon_spec.rb b/core/spec/models/spree/promotion_handler/coupon_spec.rb
index 4db976cc1a..156feeb96d 100644
--- a/core/spec/models/spree/promotion_handler/coupon_spec.rb
+++ b/core/spec/models/spree/promotion_handler/coupon_spec.rb
@@ -5,7 +5,7 @@ module Spree
describe Coupon, type: :model do
subject { Coupon.new(order) }
- let(:store) { create(:store) }
+ let(:store) { Spree::Store.default }
let(:order) { double('Order', coupon_code: '10off', store: store).as_null_object }
it 'returns self in apply' do
diff --git a/core/spec/models/spree/store_credit_spec.rb b/core/spec/models/spree/store_credit_spec.rb
index 95a1efbc10..34d89588c9 100644
--- a/core/spec/models/spree/store_credit_spec.rb
+++ b/core/spec/models/spree/store_credit_spec.rb
@@ -739,7 +739,7 @@ describe 'StoreCredit' do
end
describe '#store_events' do
- let(:store) { create(:store) }
+ let(:store) { Spree::Store.default }
context 'create' do
context 'user has one store credit' do
diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb
index ebf63b4d78..462d31c779 100644
--- a/core/spec/models/spree/store_spec.rb
+++ b/core/spec/models/spree/store_spec.rb
@@ -266,9 +266,11 @@ describe Spree::Store, type: :model do
context 'when a default store is not present' do
it 'builds a new default store' do
- expect(Spree::Store.default.class).to eq(Spree::Store)
- expect(Spree::Store.default.persisted?).to eq(false)
- expect(Spree::Store.default.default).to be(true)
+ described_class.delete_all
+ Rails.cache.clear
+ expect(described_class.default.class).to eq(described_class)
+ expect(described_class.default.persisted?).to eq(false)
+ expect(described_class.default.default).to be(true)
end
end
end
diff --git a/core/spec/models/spree/variant_spec.rb b/core/spec/models/spree/variant_spec.rb
index 19a4173c60..a16272761c 100644
--- a/core/spec/models/spree/variant_spec.rb
+++ b/core/spec/models/spree/variant_spec.rb
@@ -865,7 +865,7 @@ describe Spree::Variant, type: :model do
context 'price present and currency nil' do
before { variant.currency = nil }
- it { expect(variant.send(:check_price)).to be(Spree::Config[:currency]) }
+ it { expect(variant.send(:check_price)).to eq(Spree::Store.default.default_currency) }
end
context 'price nil and currency present' do
@@ -891,7 +891,7 @@ describe Spree::Variant, type: :model do
context 'price present and currency nil' do
before { variant.currency = nil }
- it { expect(variant.send(:check_price)).to be(Spree::Config[:currency]) }
+ it { expect(variant.send(:check_price)).to eq(Spree::Store.default.default_currency) }
end
context 'product and master_variant present and equal' do
diff --git a/core/spec/spec_helper.rb b/core/spec/spec_helper.rb
index 0623d3f17e..197737f569 100644
--- a/core/spec/spec_helper.rb
+++ b/core/spec/spec_helper.rb
@@ -63,6 +63,9 @@ RSpec.configure do |config|
begin
Rails.cache.clear
reset_spree_preferences
+
+ country = create(:country, name: 'United States of America', iso_name: 'UNITED STATES', iso: 'US', states_required: true)
+ create(:store, default: true, default_country: country, default_currency: 'USD')
rescue Errno::ENOTEMPTY
end
end
diff --git a/sample/db/samples/products.rb b/sample/db/samples/products.rb
index 608a47937b..60b4076450 100644
--- a/sample/db/samples/products.rb
+++ b/sample/db/samples/products.rb
@@ -8,8 +8,6 @@ Spree::Sample.load_sample('stores')
default_shipping_category = Spree::ShippingCategory.find_or_create_by!(name: 'Default')
clothing_tax_category = Spree::TaxCategory.find_or_create_by!(name: 'Clothing')
-Spree::Config[:currency] = 'USD'
-
color = Spree::OptionType.find_by!(name: 'color')
length = Spree::OptionType.find_by!(name: 'length')
size = Spree::OptionType.find_by!(name: 'size')