2020-08-27 19:55:37 +02:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :procedure_revision do
|
2021-11-19 13:48:52 +01:00
|
|
|
transient do
|
|
|
|
from_original { nil }
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:build) do |revision, evaluator|
|
|
|
|
if evaluator.from_original
|
|
|
|
original = evaluator.from_original
|
|
|
|
|
|
|
|
revision.procedure = original.procedure
|
2022-02-11 08:43:29 +01:00
|
|
|
revision.attestation_template_id = original.attestation_template_id
|
2022-07-06 15:55:09 +02:00
|
|
|
revision.dossier_submitted_message_id = original.dossier_submitted_message_id
|
2022-04-28 14:25:49 +02:00
|
|
|
original.revision_types_de_champ_public.each do |r_tdc|
|
|
|
|
revision.revision_types_de_champ_public << build(:procedure_revision_type_de_champ, from_original: r_tdc)
|
2021-11-19 13:48:52 +01:00
|
|
|
end
|
|
|
|
original.revision_types_de_champ_private.each do |r_tdc|
|
|
|
|
revision.revision_types_de_champ_private << build(:procedure_revision_type_de_champ, from_original: r_tdc)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-08-27 19:55:37 +02:00
|
|
|
end
|
|
|
|
end
|