diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 748cb69..839c230 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -2,7 +2,15 @@ FactoryBot.define do factory :group do + transient do + match_count { 4 } + end + sequence(:number) stage + + after(:create) do |group, evaluator| + create_list(:group_match, evaluator.match_count, group: group) + end end end diff --git a/spec/factories/stages.rb b/spec/factories/stages.rb index 4353af1..d033247 100644 --- a/spec/factories/stages.rb +++ b/spec/factories/stages.rb @@ -3,5 +3,14 @@ FactoryBot.define do factory :stage do tournament + factory :group_stage do + level { -1 } + transient do + group_count { 4 } + end + after(:create) do |stage, evaluator| + stage.groups = create_list(:group, evaluator.group_count) + end + end end end diff --git a/spec/factories/tournaments.rb b/spec/factories/tournaments.rb index 4b93176..6924332 100644 --- a/spec/factories/tournaments.rb +++ b/spec/factories/tournaments.rb @@ -11,6 +11,7 @@ FactoryBot.define do after(:create) do |tournament, evaluator| tournament.teams = create_list(:team, evaluator.teams_count, tournament: tournament) end + factory :stage_tournament do transient do stage_count { 1 } @@ -19,5 +20,11 @@ FactoryBot.define do tournament.stages = create_list(:stage, evaluator.stage_count) end end + + factory :group_stage_tournament do + after(:create) do |tournament, _evaluator| + tournament.stages = create_list(:group_stage, 1) + end + end end end