mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-14 04:04:23 +00:00
Speed up add to cart: Update the order once per fee calculation, rather than for every line item x fee
This commit is contained in:
@@ -54,6 +54,8 @@ describe Spree::Order do
|
||||
product_distribution.should_receive(:create_adjustment_for).with(line_item)
|
||||
subject.stub(:product_distribution_for) { product_distribution }
|
||||
|
||||
subject.should_receive(:update!)
|
||||
|
||||
subject.update_distribution_charge!
|
||||
end
|
||||
|
||||
@@ -65,6 +67,8 @@ describe Spree::Order do
|
||||
|
||||
subject.stub(:product_distribution_for) { nil }
|
||||
|
||||
subject.should_receive(:update!)
|
||||
|
||||
subject.update_distribution_charge!
|
||||
end
|
||||
|
||||
@@ -90,6 +94,8 @@ describe Spree::Order do
|
||||
OpenFoodNetwork::EnterpriseFeeCalculator.any_instance.stub(:create_order_adjustments_for)
|
||||
subject.stub(:order_cycle) { order_cycle }
|
||||
|
||||
subject.should_receive(:update!)
|
||||
|
||||
subject.update_distribution_charge!
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user