mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-29 21:17:17 +00:00
Fixed shipment factory by making shipments unique per order and stock_location factory by making stock_location unique
This commit is contained in:
@@ -616,3 +616,15 @@ FactoryBot.modify do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
FactoryBot.modify do
|
||||
factory :stock_location, class: Spree::StockLocation do
|
||||
# keeps the test stock_location unique
|
||||
initialize_with { Spree::StockLocation.find_or_create_by_name(name)}
|
||||
end
|
||||
|
||||
factory :shipment, class: Spree::Shipment do
|
||||
# keeps test shipments unique per order
|
||||
initialize_with { Spree::Shipment.find_or_create_by_order_id(order.id)}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user