Update groups and stages factory to be used in production

This commit is contained in:
Daniel Schädler 2019-05-19 16:46:45 +02:00
parent dd9b2dfacd
commit 658e769a7f
2 changed files with 12 additions and 2 deletions

View File

@ -3,6 +3,7 @@
FactoryBot.define do
factory :group do
transient do
matches { nil }
match_count { 4 }
end
@ -10,7 +11,11 @@ FactoryBot.define do
stage
after(:create) do |group, evaluator|
if evaluator.matches.nil?
create_list(:group_match, evaluator.match_count, group: group)
else
evaluator.matches
end
end
end
end

View File

@ -6,10 +6,15 @@ FactoryBot.define do
factory :group_stage do
level { -1 }
transient do
groups { nil }
group_count { 4 }
end
after(:create) do |stage, evaluator|
stage.groups = create_list(:group, evaluator.group_count)
stage.groups = if evaluator.groups.nil?
create_list(:group, evaluator.group_count)
else
evaluator.groups
end
end
end