diff --git a/app/helpers/spree/base_helper_decorator.rb b/app/helpers/spree/base_helper_decorator.rb index edab056346..4b38cb7bb5 100644 --- a/app/helpers/spree/base_helper_decorator.rb +++ b/app/helpers/spree/base_helper_decorator.rb @@ -11,7 +11,7 @@ module Spree checkout_zone = Zone.find_by(name: Spree::Config[:checkout_zone]) countries = if checkout_zone && checkout_zone.kind == 'country' - checkout_zone.country_list + checkout_zone.countries else Country.includes(:states).all end diff --git a/app/models/spree/zone.rb b/app/models/spree/zone.rb index ed1250d553..11c01048f3 100644 --- a/app/models/spree/zone.rb +++ b/app/models/spree/zone.rb @@ -55,7 +55,7 @@ module Spree end # convenience method for returning the countries contained within a zone - def country_list + def countries @countries ||= case kind when 'country' then zoneables when 'state' then zoneables.collect(&:country) diff --git a/spec/models/spree/zone_spec.rb b/spec/models/spree/zone_spec.rb index 9e93f21bd7..4badff1d50 100644 --- a/spec/models/spree/zone_spec.rb +++ b/spec/models/spree/zone_spec.rb @@ -63,7 +63,7 @@ describe Spree::Zone do end end - context "#country_list" do + context "#countries" do let(:state) { create(:state) } let(:country) { state.country } @@ -73,7 +73,7 @@ describe Spree::Zone do before { country_zone.members.create(zoneable: country) } it 'should return a list of countries' do - expect(country_zone.country_list).to eq [country] + expect(country_zone.countries).to eq [country] end end @@ -83,7 +83,7 @@ describe Spree::Zone do before { state_zone.members.create(zoneable: state) } it 'should return a list of countries' do - expect(state_zone.country_list).to eq [state.country] + expect(state_zone.countries).to eq [state.country] end end end