From cb82ca44d8385fc2dd2674ad6df7b855849f3d2a Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Thu, 9 May 2019 20:56:30 +0200 Subject: [PATCH] Put running playoff matches in a playoff stage (only on first level) --- spec/factories/stages.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/factories/stages.rb b/spec/factories/stages.rb index 168acb6..13c2e65 100644 --- a/spec/factories/stages.rb +++ b/spec/factories/stages.rb @@ -16,12 +16,15 @@ FactoryBot.define do factory :playoff_stage do level { rand(10) } transient do + match_state { :not_started } match_count { 4 } end after(:create) do |stage, evaluator| # match_count -1 automatically generates 2 ^ stage.level matches # (as this would be the amount of stages present in the real world) - stage.matches = create_list(:match, evaluator.match_count == -1 ? 2**stage.level : evaluator.match_count) + stage.matches = create_list(:running_playoff_match, + evaluator.match_count == -1 ? 2**stage.level : evaluator.match_count, + state: evaluator.match_state) stage.matches.each_with_index { |match, i| match.position = i } end end