Improve the Procedure factory

We can now specify how many types_de_champ a
procedure has
This commit is contained in:
gregoirenovel 2017-05-26 17:22:54 +02:00
parent b820f9d39c
commit 0cc5d85f13

View file

@ -30,10 +30,16 @@ FactoryGirl.define do
end
trait :with_type_de_champ do
after(:build) do |procedure, _evaluator|
type_de_champ = create(:type_de_champ_public)
transient do
types_de_champ_count 1
end
procedure.types_de_champ << type_de_champ
after(:build) do |procedure, evaluator|
evaluator.types_de_champ_count.times do
type_de_champ = create(:type_de_champ_public)
procedure.types_de_champ << type_de_champ
end
end
end