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.

Updates to tests.

Matthew Kennedy3dd12ed3cd91
diff --git a/core/app/models/spree/payment_method.rb b/core/app/models/spree/payment_method.rb
index a1db8f7440..0da9d75d43 100644
--- a/core/app/models/spree/payment_method.rb
+++ b/core/app/models/spree/payment_method.rb
@@ -79,7 +79,7 @@ module Spree
end
def available_for_store?(store)
- return false if store.blank?
+ return false if store.blank? || store_ids.empty?
store_ids.include?(store.id)
end
diff --git a/core/lib/spree/testing_support/order_walkthrough.rb b/core/lib/spree/testing_support/order_walkthrough.rb
index 83417056bf..18caeb4f09 100644
--- a/core/lib/spree/testing_support/order_walkthrough.rb
+++ b/core/lib/spree/testing_support/order_walkthrough.rb
@@ -5,7 +5,7 @@ class OrderWalkthrough
# A payment method must exist for an order to proceed through the Address state
unless Spree::PaymentMethod.exists?
- FactoryBot.create(:check_payment_method)
+ FactoryBot.create(:check_payment_method, stores: [store])
end
# Need to create a valid zone too...
diff --git a/frontend/spec/support/shared_contexts/checkout_address_book.rb b/frontend/spec/support/shared_contexts/checkout_address_book.rb
index c059d0ec0f..b80094c849 100644
--- a/frontend/spec/support/shared_contexts/checkout_address_book.rb
+++ b/frontend/spec/support/shared_contexts/checkout_address_book.rb
@@ -7,8 +7,8 @@ shared_context 'checkout address book' do
@tax_category = Spree::TaxCategory.first || create(:tax_category)
@shipping = Spree::ShippingMethod.find_by_name('UPS Ground') || create(:shipping_method, tax_category: @tax_category)
- create(:credit_card_payment_method)
- create(:check_payment_method)
+ create(:credit_card_payment_method, stores: [@store] )
+ create(:check_payment_method, stores: [@store])
reset_spree_preferences do |config|
config.company = true
diff --git a/frontend/spec/support/shared_contexts/checkout_setup.rb b/frontend/spec/support/shared_contexts/checkout_setup.rb
index 67f58cce39..599bccb340 100644
--- a/frontend/spec/support/shared_contexts/checkout_setup.rb
+++ b/frontend/spec/support/shared_contexts/checkout_setup.rb
@@ -6,7 +6,7 @@ shared_context 'checkout setup' do
let!(:mug) { create(:product, name: 'RoR Mug') }
let!(:credit_card_payment) { create(:credit_card_payment_method) }
let!(:check_payment) { create(:check_payment_method) }
- let!(:unsupported_payment) { create(:check_payment_method, store: create(:store)) }
+ let!(:unsupported_payment) { create(:check_payment_method, stores: [create(:store)]) }
let!(:zone) { create(:zone) }
let!(:store) { create(:store) }