Skip to content

Commit

Permalink
Remove reimbursement methods from StoreCreditCategory
Browse files Browse the repository at this point in the history
It removes:

- .reimbursement_category_name
- .reimbursement_category_name=
- .reimbursement_category
- #reimbursement_category_name

ref: solidusio#3507
  • Loading branch information
kennyadsl committed Nov 27, 2020
1 parent da29568 commit 04bee89
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
32 changes: 0 additions & 32 deletions core/app/models/spree/store_credit_category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,7 @@ class Spree::StoreCreditCategory < Spree::Base
class_attribute :non_expiring_credit_types
self.non_expiring_credit_types = [Spree::StoreCreditType::NON_EXPIRING]

# @deprecated
class_attribute :reimbursement_category_name
self.reimbursement_category_name = I18n.t('spree.store_credit_category.default')

# @deprecated
def self.reimbursement_category(reimbursement)
reimbursement.store_credit_category
end

def non_expiring?
self.class.non_expiring_credit_types.include? name
end

public_instance_methods.grep(/^reimbursement_category_name/).each do |method|
deprecate(
method => 'Use Spree::Reimbursement#store_credit_category.name instead',
deprecator: Spree::Deprecation
)
end

class << self
public_instance_methods.grep(/^reimbursement_category_name/).each do |method|
deprecate(
method => 'Use Spree::Reimbursement.store_credit_category.name instead',
deprecator: Spree::Deprecation
)
end

public_instance_methods.grep(/^reimbursement_category$/).each do |method|
deprecate(
method => 'Use Spree::Reimbursement.store_credit_category instead',
deprecator: Spree::Deprecation
)
end
end
end
22 changes: 0 additions & 22 deletions core/spec/models/spree/store_credit_category_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,4 @@
it { expect(store_credit_category).not_to be_non_expiring }
end
end

describe '.reimbursement_category' do
it 'raises a dreprecation warning' do
allow(Spree::Deprecation).to receive(:warn)

described_class.reimbursement_category(Spree::Reimbursement.new)

expect(Spree::Deprecation).to have_received(:warn)
.with(/reimbursement_category /, any_args)
end
end

describe '.reimbursement_category_name' do
it 'raises a dreprecation warning' do
allow(Spree::Deprecation).to receive(:warn)

described_class.reimbursement_category_name

expect(Spree::Deprecation).to have_received(:warn)
.with(/reimbursement_category_name /, any_args)
end
end
end

0 comments on commit 04bee89

Please sign in to comment.