mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Remove #order_update! from line item after_save callback
This commit is contained in:
@@ -230,7 +230,6 @@ module Spree
|
||||
|
||||
# update the order totals, etc.
|
||||
order.create_tax_charge!
|
||||
order.update_order!
|
||||
end
|
||||
|
||||
def update_inventory_before_destroy
|
||||
|
||||
@@ -76,6 +76,7 @@ module Spree
|
||||
end
|
||||
|
||||
def update_order
|
||||
order.update_order!
|
||||
order.reload
|
||||
end
|
||||
end
|
||||
|
||||
@@ -212,7 +212,7 @@ describe Admin::BulkLineItemsController, type: :controller do
|
||||
expect(line_item1.order).to receive(:reload).with(lock: true)
|
||||
expect(line_item1.order).to receive(:update_line_item_fees!)
|
||||
expect(line_item1.order).to receive(:update_order_fees!)
|
||||
expect(line_item1.order).to receive(:update_order!).twice
|
||||
expect(line_item1.order).to receive(:update_order!)
|
||||
|
||||
spree_put :update, params
|
||||
end
|
||||
|
||||
@@ -11,7 +11,6 @@ module Spree
|
||||
it 'should update inventory, totals, and tax' do
|
||||
# Regression check for Spree #1481
|
||||
expect(line_item.order).to receive(:create_tax_charge!)
|
||||
expect(line_item.order).to receive(:update_order!)
|
||||
line_item.quantity = 2
|
||||
line_item.save
|
||||
end
|
||||
|
||||
@@ -443,7 +443,10 @@ describe OrderSyncer do
|
||||
before { variant.update_attribute(:on_hand, 3) }
|
||||
|
||||
context "when the changed line_item quantity matches the new quantity on the subscription line item" do
|
||||
before { changed_line_item.update(quantity: 3) }
|
||||
before do
|
||||
changed_line_item.update(quantity: 3)
|
||||
order.update_order!
|
||||
end
|
||||
|
||||
it "does not change the quantity, and doesn't add the order to order_update_issues" do
|
||||
expect(order.reload.total.to_f).to eq 99.95
|
||||
@@ -456,7 +459,10 @@ describe OrderSyncer do
|
||||
end
|
||||
|
||||
context "when the changed line_item quantity doesn't match the new quantity on the subscription line item" do
|
||||
before { changed_line_item.update(quantity: 2) }
|
||||
before do
|
||||
changed_line_item.update(quantity: 2)
|
||||
order.update_order!
|
||||
end
|
||||
|
||||
it "does not change the quantity, and adds the order to order_update_issues" do
|
||||
expect(order.reload.total.to_f).to eq 79.96
|
||||
|
||||
Reference in New Issue
Block a user