Update groups and stages factory to be used in production
This commit is contained in:
parent
dd9b2dfacd
commit
658e769a7f
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue