2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-07-16 14:39:04 +02:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :deleted_dossier do
|
2018-09-04 16:46:48 +02:00
|
|
|
dossier_id { 1111 }
|
|
|
|
state { Dossier.states.fetch(:en_construction) }
|
2020-03-26 20:25:19 +01:00
|
|
|
reason { DeletedDossier.reasons.fetch(:user_request) }
|
2018-10-25 15:07:15 +02:00
|
|
|
deleted_at { Time.zone.now }
|
2018-07-16 14:39:04 +02:00
|
|
|
|
|
|
|
association :procedure, :published
|
2022-03-09 10:29:16 +01:00
|
|
|
|
|
|
|
transient do
|
|
|
|
dossier { nil }
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:build) do |deleted_dossier, evaluator|
|
|
|
|
if evaluator.dossier
|
|
|
|
deleted_dossier.dossier_id = evaluator.dossier.id
|
|
|
|
deleted_dossier.state = evaluator.dossier.state
|
|
|
|
deleted_dossier.procedure = evaluator.dossier.procedure
|
|
|
|
end
|
|
|
|
end
|
2018-07-16 14:39:04 +02:00
|
|
|
end
|
|
|
|
end
|