mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fixed factory completed_order_with_fees by skipping a failing and unnecessary part of the checkout workflow
Fixed factory's shipment_with shipping_fees trait by ensuring only one shipping_rate in the shipment
This commit is contained in:
@@ -385,6 +385,7 @@ FactoryBot.define do
|
||||
|
||||
after(:create) do |shipment, evaluator|
|
||||
shipping_method = create(:shipping_method_with, :shipping_fee, shipping_fee: evaluator.shipping_fee)
|
||||
shipment.shipping_rates.destroy_all # remove existing shipping_rates from shipment
|
||||
shipment.add_shipping_method(shipping_method, true)
|
||||
end
|
||||
end
|
||||
@@ -408,6 +409,9 @@ FactoryBot.define do
|
||||
payment_calculator = build(:calculator_per_item, preferred_amount: evaluator.payment_fee)
|
||||
payment_method = create(:payment_method, calculator: payment_calculator)
|
||||
create(:payment, order: order, amount: order.total, payment_method: payment_method, state: 'checkout')
|
||||
|
||||
# skip the rebuilding of order.shipments from line_items and stock locations (this is enforced in checkout step :address to :delivery)
|
||||
order.stub(:create_proposed_shipments)
|
||||
while !order.completed? do break unless order.next! end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user