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.

Allow to pass store to OrderWalkthrough

Damian Legawiec2aeb515e392a
diff --git a/core/lib/spree/testing_support/order_walkthrough.rb b/core/lib/spree/testing_support/order_walkthrough.rb
index a65bc21ba9..fe284bb79e 100644
--- a/core/lib/spree/testing_support/order_walkthrough.rb
+++ b/core/lib/spree/testing_support/order_walkthrough.rb
@@ -1,12 +1,12 @@
class OrderWalkthrough
- def self.up_to(state)
- store = if Spree::Store.exists?
- # Ensure the default store is used
- Spree::Store.default || FactoryBot.create(:store, default: true)
- else
- # Create a default store
- FactoryBot.create(:store, default: true)
- end
+ def self.up_to(state, store = nil)
+ store ||= if Spree::Store.exists?
+ # Ensure the default store is used
+ Spree::Store.default || FactoryBot.create(:store, default: true)
+ else
+ # Create a default store
+ FactoryBot.create(:store, default: true)
+ end
# A payment method must exist for an order to proceed through the Address state
unless Spree::PaymentMethod.exists?