mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Ensure order total for uplaced subscription orders is zero
This commit is contained in:
committed by
Maikel Linke
parent
50ffd7ca01
commit
f5e77cdcec
@@ -34,7 +34,7 @@ class SubscriptionPlacementJob
|
||||
|
||||
changes = cap_quantity_and_store_changes(order)
|
||||
if order.line_items.where('quantity > 0').empty?
|
||||
order.adjustments.destroy_all
|
||||
order.reload.adjustments.destroy_all
|
||||
return send_empty_email(order, changes)
|
||||
end
|
||||
|
||||
|
||||
@@ -149,7 +149,8 @@ describe SubscriptionPlacementJob do
|
||||
|
||||
it "does not place the order, clears, all adjustments, and sends an empty_order email" do
|
||||
expect{ job.send(:process, order) }.to_not change{ order.reload.completed_at }.from(nil)
|
||||
expect(order.reload.adjustments).to be_empty
|
||||
expect(order.adjustments).to be_empty
|
||||
expect(order.total).to eq 0
|
||||
expect(job).to_not have_received(:send_placement_email)
|
||||
expect(job).to have_received(:send_empty_email)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user