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,12 +30,18 @@ FactoryGirl.define do
end end
trait :with_type_de_champ do trait :with_type_de_champ do
after(:build) do |procedure, _evaluator| transient do
types_de_champ_count 1
end
after(:build) do |procedure, evaluator|
evaluator.types_de_champ_count.times do
type_de_champ = create(:type_de_champ_public) type_de_champ = create(:type_de_champ_public)
procedure.types_de_champ << type_de_champ procedure.types_de_champ << type_de_champ
end end
end end
end
trait :with_type_de_champ_private do trait :with_type_de_champ_private do
after(:build) do |procedure, _evaluator| after(:build) do |procedure, _evaluator|