From 535fd56b9cc9a2e904bc04da85c71b0e5eac6046 Mon Sep 17 00:00:00 2001 From: Alberto Vena Date: Wed, 4 Nov 2020 15:41:02 +0100 Subject: [PATCH] Remove use_legacy_store_credit_reimbursement_category_name preference This will not be used anymore since the only non-deprecated behavior governed by this preference will be the one that we will keep in Solidus 3.0. Please refer to the 2.11 CHANGELOG for more details on how to handle this preference. --- core/app/models/spree/reimbursement.rb | 9 --------- core/lib/spree/app_configuration.rb | 6 ------ core/lib/spree/testing_support/dummy_app.rb | 1 - core/spec/models/spree/reimbursement_spec.rb | 13 ------------- 4 files changed, 29 deletions(-) diff --git a/core/app/models/spree/reimbursement.rb b/core/app/models/spree/reimbursement.rb index f1291166128..397fc14b0b1 100644 --- a/core/app/models/spree/reimbursement.rb +++ b/core/app/models/spree/reimbursement.rb @@ -168,15 +168,6 @@ def return_all(created_by: nil) # # @return [Spree::StoreCreditCategory] def store_credit_category - if Spree::Config.use_legacy_store_credit_reimbursement_category_name - Spree::Deprecation.warn("Using the legacy reimbursement_category_name is deprecated. "\ - "Set Spree::Config.use_legacy_store_credit_reimbursement_category_name to false to use "\ - "the new version instead.", caller) - - name = Spree::StoreCreditCategory.reimbursement_category_name - return Spree::StoreCreditCategory.find_by(name: name) || Spree::StoreCreditCategory.first - end - Spree::StoreCreditCategory.find_by(name: Spree::StoreCreditCategory::REIMBURSEMENT) end diff --git a/core/lib/spree/app_configuration.rb b/core/lib/spree/app_configuration.rb index b861307aa5e..e553798ef2f 100644 --- a/core/lib/spree/app_configuration.rb +++ b/core/lib/spree/app_configuration.rb @@ -283,12 +283,6 @@ class AppConfiguration < Preferences::Configuration preference :track_inventory_levels, :boolean, default: true - # The legacy_store_credit_category_name allows to control whether the legacy - # way of fetching the category should be used. - # - # @param [Boolean] enable/disable the legacy way of fetching the store category name - preference :use_legacy_store_credit_reimbursement_category_name, :boolean, default: true - # Other configurations # Allows restricting what currencies will be available. diff --git a/core/lib/spree/testing_support/dummy_app.rb b/core/lib/spree/testing_support/dummy_app.rb index 768dda9f3aa..7f17a18da86 100644 --- a/core/lib/spree/testing_support/dummy_app.rb +++ b/core/lib/spree/testing_support/dummy_app.rb @@ -118,7 +118,6 @@ class Application < ::Rails::Application Spree.config do |config| config.mails_from = "store@example.com" config.consider_actionless_promotion_active = false - config.use_legacy_store_credit_reimbursement_category_name = false if ENV['ENABLE_ACTIVE_STORAGE'] config.image_attachment_module = 'Spree::Image::ActiveStorageAttachment' diff --git a/core/spec/models/spree/reimbursement_spec.rb b/core/spec/models/spree/reimbursement_spec.rb index ac15677cfbd..507d149ea80 100644 --- a/core/spec/models/spree/reimbursement_spec.rb +++ b/core/spec/models/spree/reimbursement_spec.rb @@ -284,20 +284,7 @@ create(:store_credit_category, :reimbursement) end - context 'when using the legacy version' do - before do - stub_spree_preferences(use_legacy_store_credit_reimbursement_category_name: true) - end - - it 'issues a deprecation warning and returns the first category created' do - expect(Spree::StoreCreditCategory).to receive(:reimbursement_category_name) - expect(Spree::Deprecation).to receive(:warn) - expect(reimbursement.store_credit_category.name).to eq('foo') - end - end - it 'fetches the the default reimbursement store category' do - expect(Spree::Config.use_legacy_store_credit_reimbursement_category_name).to eq(false) expect(reimbursement.store_credit_category.name).to eq('Reimbursement') end end