brimatteng on main
oh and I forgot my trait :with_patients looks like this:
trait :with_patients do
transient do
count { 1 }
traits { [] }
end
after(:create) do |cart, evaluator|
create_list(:carts_patient, evaluator.count, *evaluator.traits, cart: cart)
cart.reload
end
end
so thats why my first example works.
(transient => traits is an array)
Any way to do it better ?
At least wrap this :
create(:cart, :with_address, :with_patients, traits: [:with_products])
in to something like that:
factory :order_ready_cart do
create(:cart, :with_address, :with_patients, traits: [:with_products])
end