2022-11-18 15:26:31 +01:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :batch_operation do
|
2022-11-19 06:03:59 +01:00
|
|
|
transient do
|
|
|
|
invalid_instructeur { nil }
|
|
|
|
end
|
2022-11-25 15:43:00 +01:00
|
|
|
|
2022-12-05 13:36:38 +01:00
|
|
|
association :instructeur
|
|
|
|
|
2022-11-18 16:59:46 +01:00
|
|
|
trait :archiver do
|
|
|
|
operation { BatchOperation.operations.fetch(:archiver) }
|
2022-12-02 17:16:29 +01:00
|
|
|
after(:build) do |batch_operation, evaluator|
|
|
|
|
procedure = create(:simple_procedure, :published, instructeurs: [evaluator.invalid_instructeur.presence || batch_operation.instructeur], administrateurs: [create(:administrateur)])
|
2022-11-19 06:03:59 +01:00
|
|
|
batch_operation.dossiers = [
|
2022-11-25 15:43:00 +01:00
|
|
|
create(:dossier, :with_individual, :accepte, procedure: procedure),
|
|
|
|
create(:dossier, :with_individual, :refuse, procedure: procedure),
|
|
|
|
create(:dossier, :with_individual, :sans_suite, procedure: procedure)
|
2022-11-18 16:59:46 +01:00
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
2022-12-12 10:02:33 +01:00
|
|
|
|
|
|
|
trait :passer_en_instruction do
|
|
|
|
operation { BatchOperation.operations.fetch(:passer_en_instruction) }
|
|
|
|
after(:build) do |batch_operation, evaluator|
|
|
|
|
procedure = create(:simple_procedure, :published, instructeurs: [evaluator.invalid_instructeur.presence || batch_operation.instructeur], administrateurs: [create(:administrateur)])
|
|
|
|
batch_operation.dossiers = [
|
|
|
|
create(:dossier, :with_individual, :en_construction, procedure: procedure),
|
|
|
|
create(:dossier, :with_individual, :en_construction, procedure: procedure)
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
2022-11-18 15:26:31 +01:00
|
|
|
end
|
|
|
|
end
|