Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused app config options #13058

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/helpers/spree/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Spree
module BaseHelper
def available_countries
checkout_zone = Zone.find_by(name: Spree::Config[:checkout_zone])
checkout_zone = Zone.find_by(name: ENV.fetch("CHECKOUT_ZONE", nil))

countries = if checkout_zone && checkout_zone.kind == 'country'
checkout_zone.countries
Expand Down
1 change: 0 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class Application < Rails::Application
# of Spree
initializer 'ofn.spree_locale_settings', before: 'spree.promo.environment' do |app|
Rails.application.reloader.to_prepare do
Spree::Config['checkout_zone'] = ENV['CHECKOUT_ZONE']
Spree::Config['currency'] = ENV['CURRENCY']
end
end
Expand Down
2 changes: 0 additions & 2 deletions spec/base_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,12 @@
end

default_country_id = DefaultCountry.id
checkout_zone = Spree::Config[:checkout_zone]
currency = Spree::Config[:currency]
# Ensure we start with consistent config settings
config.before(:each) do
reset_spree_preferences do |spree_config|
# These are all settings that differ from Spree's defaults
spree_config.default_country_id = default_country_id
spree_config.checkout_zone = checkout_zone
spree_config.currency = currency
spree_config.shipping_instructions = true
end
Expand Down
7 changes: 4 additions & 3 deletions spec/helpers/spree/base_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

before do
3.times { create(:country) }
allow(ENV).to receive(:fetch).and_call_original
end

context "with no checkout zone defined" do
before do
Spree::Config[:checkout_zone] = nil
allow(ENV).to receive(:fetch).and_return(nil)
dacook marked this conversation as resolved.
Show resolved Hide resolved
end

it "return complete list of countries" do
Expand All @@ -27,7 +28,7 @@
before do
@country_zone = create(:zone, name: "CountryZone")
@country_zone.members.create(zoneable: country)
Spree::Config[:checkout_zone] = @country_zone.name
allow(ENV).to receive(:fetch).and_return(@country_zone.name)
end

it "return only the countries defined by the checkout zone" do
Expand All @@ -40,7 +41,7 @@
state_zone = create(:zone, name: "StateZone")
state = create(:state, country:)
state_zone.members.create(zoneable: state)
Spree::Config[:checkout_zone] = state_zone.name
allow(ENV).to receive(:fetch).and_return(state_zone.name)
end

it "return complete list of countries" do
Expand Down