Merge pull request #9190 from georgethoppil/duplicate-transaction-fees

Destroy all adjustments on cart empty
This commit is contained in:
Filipe
2022-06-02 11:36:27 +01:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -430,9 +430,10 @@ module Spree
def empty!
line_items.destroy_all
adjustments.destroy_all
all_adjustments.destroy_all
payments.clear
shipments.destroy_all
restart_checkout_flow if state == "payment"
end
def state_changed(name)

View File

@@ -315,7 +315,7 @@ describe Spree::Order do
allow(order).to receive_messages(line_items: line_items = [])
allow(order).to receive_messages(adjustments: adjustments = [])
expect(order.line_items).to receive(:destroy_all)
expect(order.adjustments).to receive(:destroy_all)
expect(order.all_adjustments).to receive(:destroy_all)
order.empty!
end