From b5e4ec7ea33bd7d457961f7aa5360af2ebd7c3d0 Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Fri, 10 May 2019 11:50:46 +0200 Subject: [PATCH] For stage tournament, first stage has running matches --- spec/factories/tournaments.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/factories/tournaments.rb b/spec/factories/tournaments.rb index ab5d90a..92a5459 100644 --- a/spec/factories/tournaments.rb +++ b/spec/factories/tournaments.rb @@ -18,9 +18,14 @@ FactoryBot.define do end after(:create) do |tournament, evaluator| # 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 + levels = 1..evaluator.stage_count + tournament.stages.concat levels + .map { |level| + create(:playoff_stage, + level: level, + match_count: -1, + match_state: level == evaluator.stage_count ? :in_progress : :not_started) + } end factory :group_stage_tournament do