diff --git a/core/app/models/spree/adjustment.rb b/core/app/models/spree/adjustment.rb index 3ec22c90a9e..7f60ad02d8c 100644 --- a/core/app/models/spree/adjustment.rb +++ b/core/app/models/spree/adjustment.rb @@ -122,6 +122,7 @@ def recalculate end amount end + deprecate :recalculate, deprecator: Spree.deprecator # Calculates based on attached promotion (if this is a promotion # adjustment) whether this promotion is still eligible. diff --git a/core/lib/spree/testing_support/factories/adjustment_factory.rb b/core/lib/spree/testing_support/factories/adjustment_factory.rb index 683634ce3da..810b7efe3c1 100644 --- a/core/lib/spree/testing_support/factories/adjustment_factory.rb +++ b/core/lib/spree/testing_support/factories/adjustment_factory.rb @@ -31,7 +31,7 @@ adjustment.source.tax_categories = [] end adjustment.source.save - adjustment.recalculate + adjustment.update!(amount: adjustment.source.compute_amount(adjustment.adjustable)) end end end diff --git a/core/spec/models/spree/adjustment_spec.rb b/core/spec/models/spree/adjustment_spec.rb index f8701b7e486..7254c69db34 100644 --- a/core/spec/models/spree/adjustment_spec.rb +++ b/core/spec/models/spree/adjustment_spec.rb @@ -92,6 +92,12 @@ let(:order) { create(:order_with_line_items, line_items_price: 100) } let(:line_item) { order.line_items.to_a.first } + around do |example| + Spree.deprecator.silence do + example.run + end + end + context "when adjustment is finalized" do let(:finalized) { true }