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.

Fix random email specs failures with race conditions

Damian Legawiec8026b38ebe76
diff --git a/core/lib/spree/testing_support/store.rb b/core/lib/spree/testing_support/store.rb
index 649e4d6e0e..91ae0f3972 100644
--- a/core/lib/spree/testing_support/store.rb
+++ b/core/lib/spree/testing_support/store.rb
@@ -13,8 +13,12 @@ RSpec.configure do |config|
config.before(:all) do
unless self.class.metadata[:without_global_store]
- @default_country = Spree::Country.find_by(iso: 'US') || FactoryBot.create(:country_us)
- @default_store = Spree::Store.find_by(default: true) || FactoryBot.create(:store, default: true, default_country: @default_country, default_currency: 'USD')
+ # Ensure locale is set to :en before creating store to avoid translation issues
+ # when previous tests left the locale in a different language
+ I18n.with_locale(:en) do
+ @default_country = Spree::Country.find_by(iso: 'US') || FactoryBot.create(:country_us)
+ @default_store = Spree::Store.find_by(default: true) || FactoryBot.create(:store, default: true, default_country: @default_country, default_currency: 'USD')
+ end
end
end