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 for Code Climate issues.

Matthew Kennedy64f8e258fdb2
diff --git a/core/lib/spree/testing_support/order_walkthrough.rb b/core/lib/spree/testing_support/order_walkthrough.rb
index 7eb799f198..8e6e4ed661 100644
--- a/core/lib/spree/testing_support/order_walkthrough.rb
+++ b/core/lib/spree/testing_support/order_walkthrough.rb
@@ -1,13 +1,11 @@
class OrderWalkthrough
def self.up_to(state)
-
- # If one or more stores exist, set the local variable to the default Store
- # else creat a new default store from scratch.
- if Spree::Store.exists?
- store = Spree::Store.default || FactoryBot.create(:store, default: true)
- else
- store = FactoryBot.create(:store, default: true)
- end
+ store = if Spree::Store.exists?
+ # Ensure default store is used
+ Spree::Store.default || FactoryBot.create(:store, default: true)
+ else
+ FactoryBot.create(:store, default: true)
+ end
# A payment method must exist for an order to proceed through the Address state
unless Spree::PaymentMethod.exists?
@@ -65,7 +63,7 @@ class OrderWalkthrough
amount: order.total
# TODO: maybe look at some way of making this payment_state change automatic
- order.payment_state = 'paid'
+ order.payment_state = "paid"
order.next!
end