specs: create dossier revision and individual declaratively
This commit is contained in:
parent
f2233300b6
commit
2203a7762f
1 changed files with 2 additions and 10 deletions
|
@ -5,6 +5,8 @@ FactoryBot.define do
|
|||
|
||||
user { association :user }
|
||||
groupe_instructeur { procedure.routee? ? nil : procedure.defaut_groupe_instructeur }
|
||||
revision { procedure.active_revision }
|
||||
individual { association(:individual, :empty, dossier: instance, strategy: :build) if procedure.for_individual? }
|
||||
|
||||
transient do
|
||||
for_individual? { false }
|
||||
|
@ -15,16 +17,6 @@ FactoryBot.define do
|
|||
procedure { create(:procedure, :published, :with_type_de_champ, :with_type_de_champ_private, for_individual: for_individual?) }
|
||||
end
|
||||
|
||||
after(:build) do |dossier, evaluator|
|
||||
procedure = evaluator.procedure
|
||||
|
||||
dossier.revision = procedure.active_revision
|
||||
|
||||
if procedure.for_individual? && dossier.individual.blank?
|
||||
build(:individual, :empty, dossier: dossier)
|
||||
end
|
||||
end
|
||||
|
||||
trait :with_entreprise do
|
||||
after(:build) do |dossier, _evaluator|
|
||||
if dossier.procedure.for_individual?
|
||||
|
|
Loading…
Add table
Reference in a new issue