diff --git a/spec/controllers/statistics_controller_spec.rb b/spec/controllers/statistics_controller_spec.rb index d516098..bd105e1 100644 --- a/spec/controllers/statistics_controller_spec.rb +++ b/spec/controllers/statistics_controller_spec.rb @@ -13,7 +13,7 @@ RSpec.describe StatisticsController, type: :controller do context 'tournament with a group stage' do before do - @tournament = create(:group_stage_only_tournament) + @tournament = create(:group_stage_tournament, stage_count: 0) @group_stage = @tournament.stages.find_by(level: -1) @most_dominant_score = create(:group_score, team: @tournament.teams.first, diff --git a/spec/factories/tournaments.rb b/spec/factories/tournaments.rb index 637564c..b4a522a 100644 --- a/spec/factories/tournaments.rb +++ b/spec/factories/tournaments.rb @@ -12,15 +12,6 @@ FactoryBot.define do tournament.teams = create_list(:team, evaluator.teams_count, tournament: tournament) end - factory :group_stage_only_tournament do - transient do - group_count { 2 } - end - after(:create) do |tournament, evaluator| - tournament.stages << create(:group_stage, group_count: evaluator.group_count) - end - end - factory :stage_tournament do transient do stage_count { 1 } @@ -44,8 +35,14 @@ FactoryBot.define do end factory :group_stage_tournament do - after(:create) do |tournament, _evaluator| - tournament.stages << create(:group_stage) + transient do + group_count { 2 } + match_factory { :group_match } + end + after(:create) do |tournament, evaluator| + tournament.stages << create(:group_stage, + match_factory: evaluator.match_factory, + group_count: evaluator.group_count) end end end diff --git a/spec/interactors/add_group_stage_to_tournament_interactor_spec.rb b/spec/interactors/add_group_stage_to_tournament_interactor_spec.rb index d7a3208..6e009df 100644 --- a/spec/interactors/add_group_stage_to_tournament_interactor_spec.rb +++ b/spec/interactors/add_group_stage_to_tournament_interactor_spec.rb @@ -11,7 +11,7 @@ RSpec.describe AddGroupStageToTournament do before do @empty_tournament = create(:stageless_tournament) - @group_stage_tournament = create(:group_stage_only_tournament, group_count: 0) + @group_stage_tournament = create(:group_stage_tournament, stage_count: 0, group_count: 0) @group_stage = create(:group_stage) @groups = Hash[1 => create_list(:team, 4), 2 => create_list(:team, 4)].values end diff --git a/spec/interactors/add_playoffs_to_tournament_interactor_spec.rb b/spec/interactors/add_playoffs_to_tournament_interactor_spec.rb index 884f0e8..ca60cf9 100644 --- a/spec/interactors/add_playoffs_to_tournament_interactor_spec.rb +++ b/spec/interactors/add_playoffs_to_tournament_interactor_spec.rb @@ -14,7 +14,7 @@ RSpec.describe AddPlayoffsToTournament do end before do - @group_stage_tournament = create(:group_stage_only_tournament, group_count: 0) + @group_stage_tournament = create(:group_stage_tournament, stage_count: 0, group_count: 0) @playoff_stage_tournament = create(:stageless_tournament) @full_tournament = create(:dummy_stage_tournament) @stages = create_list(:stage, 3)