mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix specs to adapt to the fact that for the order workflow to get to delivery, the shipping method must be linked to the order distributor otherwise it's ignored when creating the order shipment
This commit is contained in:
@@ -443,6 +443,7 @@ FactoryBot.define do
|
||||
shipment = order.reload.shipments.first
|
||||
if shipment.nil?
|
||||
shipping_method = create(:shipping_method_with, :shipping_fee, shipping_fee: shipping_fee)
|
||||
shipping_method.distributors << order.distributor if order.distributor
|
||||
shipment = create(:shipment_with, :shipping_method, shipping_method: shipping_method, order: order)
|
||||
end
|
||||
shipment
|
||||
|
||||
@@ -78,7 +78,9 @@ describe ProxyOrder, type: :model do
|
||||
describe "resume" do
|
||||
let!(:payment_method) { create(:payment_method) }
|
||||
let!(:shipment) { create(:shipment) }
|
||||
let(:order) { create(:order_with_totals, ship_address: create(:address), shipments: [shipment]) }
|
||||
let(:order) { create(:order_with_totals, ship_address: create(:address),
|
||||
shipments: [shipment],
|
||||
distributor: shipment.shipping_method.distributors.first) }
|
||||
let(:proxy_order) { create(:proxy_order, order: order, canceled_at: Time.zone.now) }
|
||||
let(:order_cycle) { proxy_order.order_cycle }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ describe OrderFactory do
|
||||
let(:shop) { create(:distributor_enterprise) }
|
||||
let(:order_cycle) { create(:simple_order_cycle) }
|
||||
let!(:other_shipping_method_a) { create(:shipping_method) }
|
||||
let!(:shipping_method) { create(:shipping_method) }
|
||||
let!(:shipping_method) { create(:shipping_method, distributors: [shop]) }
|
||||
let!(:other_shipping_method_b) { create(:shipping_method) }
|
||||
let(:payment_method) { create(:payment_method) }
|
||||
let(:ship_address) { create(:address) }
|
||||
|
||||
Reference in New Issue
Block a user