add specs

This commit is contained in:
viehlieb 2025-05-22 12:27:25 +02:00
parent e902aa0d5a
commit 45db0575b1
46 changed files with 714 additions and 238 deletions

View file

@ -0,0 +1,21 @@
require 'factory_bot'
FactoryBot.define do
factory :multi_order do
transient do
orders { [create(:order, state: 'closed')] }
end
after(:build) do |multi_order, evaluator|
# Assign orders before validation so custom validations can see them
multi_order.orders = evaluator.orders
end
after(:create) do |multi_order, _evaluator|
# Persist the relationship by updating the orders (if needed)
multi_order.orders.each do |order|
order.update!(multi_order: multi_order)
end
end
end
end