Merge pull request #12954 from rioug/fix-shipment-not-updated

Ensure shipment gets updated when an order is updated
This commit is contained in:
Filipe
2024-12-26 15:56:12 -06:00
committed by GitHub
2 changed files with 13 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ module Spree
line_item.price = variant.price
order.line_items << line_item
end
update_shipment
order.reload
line_item

View File

@@ -175,6 +175,12 @@ RSpec.describe Spree::OrderContents do
expect(line_item.max_quantity).to eq 3
expect(line_item.price).to eq variant.price
end
it "ensures shipments are updated" do
expect(order).to receive(:ensure_updated_shipments)
subject.update_or_create(variant, { quantity: 2, max_quantity: 3 })
end
end
describe "updating" do
@@ -186,6 +192,12 @@ RSpec.describe Spree::OrderContents do
expect(line_item.reload.quantity).to eq 3
expect(line_item.max_quantity).to eq 4
end
it "ensures shipments are updated" do
expect(order).to receive(:ensure_updated_shipments)
subject.update_or_create(variant, { quantity: 3, max_quantity: 4 })
end
end
end
end