Manually create the list of stages to assign stage levels correctly

This commit is contained in:
Daniel Schädler 2019-05-09 16:14:27 +02:00
parent 8785c2075d
commit 2601f0ae31
1 changed files with 4 additions and 1 deletions

View File

@ -17,7 +17,10 @@ FactoryBot.define do
stage_count { 1 }
end
after(:create) do |tournament, evaluator|
tournament.stages = create_list(:stage, evaluator.stage_count)
# this is basically a manual create_list as we need to count up the level of the stage
tournament.stages.concat 1..evaluator.stage_count.map do |level|
create(:playoff_stage, level: level, match_count: -1)
end
end
factory :group_stage_tournament do