2022-05-23 15:09:22 +02:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :targeted_user_link do
|
|
|
|
target_context { TargetedUserLink.target_contexts[:avis] }
|
|
|
|
target_model { create(:avis) }
|
|
|
|
transient do
|
|
|
|
user {}
|
|
|
|
end
|
|
|
|
after(:build) do |targeted_user_link|
|
2022-06-13 16:00:41 +02:00
|
|
|
case targeted_user_link.target_context
|
|
|
|
when 'avis'
|
|
|
|
targeted_user_link.user = targeted_user_link.target_model.expert.user
|
|
|
|
when 'invite'
|
|
|
|
targeted_user_link.user = targeted_user_link.target_model&.user
|
|
|
|
end
|
2022-05-23 15:09:22 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|