Skip to content

Commit

Permalink
Remove use_legacy_store_credit_reimbursement_category_name preference
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kennyadsl committed Jan 28, 2021
1 parent 02ec0e1 commit 535fd56
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 29 deletions.
9 changes: 0 additions & 9 deletions core/app/models/spree/reimbursement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions core/lib/spree/app_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion core/lib/spree/testing_support/dummy_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class Application < ::Rails::Application
Spree.config do |config|
config.mails_from = "[email protected]"
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'
Expand Down
13 changes: 0 additions & 13 deletions core/spec/models/spree/reimbursement_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 535fd56

Please sign in to comment.