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.

When Store checkout zone is not set it should return all countries as available

Damian Legawiec3480e023e575
diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb
index 477cc6ffd8..c6e91b8b16 100644
--- a/core/app/models/spree/store.rb
+++ b/core/app/models/spree/store.rb
@@ -157,7 +157,7 @@ module Spree
end
def countries_available_for_checkout
- @countries_available_for_checkout ||= checkout_zone_or_default.try(:country_list) || Spree::Country.all
+ @countries_available_for_checkout ||= checkout_zone.try(:country_list) || Spree::Country.all
end
def states_available_for_checkout(country)
diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb
index 94c00c8727..b5b449b515 100644
--- a/core/spec/models/spree/store_spec.rb
+++ b/core/spec/models/spree/store_spec.rb
@@ -359,23 +359,11 @@ describe Spree::Store, type: :model do
context do
include_context 'with checkout zone not set'
- context do
- include_context 'with default checkout zone set'
-
- it 'returns country list for default checkout zone' do
- expect(subject.countries_available_for_checkout).to eq [country3]
- end
- end
+ it 'returns list of all countries' do
+ checkout_available_countries_ids = subject.countries_available_for_checkout.ids
+ all_countries_ids = Spree::Country.all.ids
- context do
- include_context 'with default checkout zone not set'
-
- it 'returns list of all countries' do
- checkout_available_countries_ids = subject.countries_available_for_checkout.ids
- all_countries_ids = Spree::Country.all.ids
-
- expect(checkout_available_countries_ids).to eq(all_countries_ids)
- end
+ expect(checkout_available_countries_ids).to eq(all_countries_ids)
end
end
end