diff --git a/spec/controllers/statistics_controller_spec.rb b/spec/controllers/statistics_controller_spec.rb index 36673b2..d516098 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_tournament) + @tournament = create(:group_stage_only_tournament) @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 eb24912..a24edf8 100644 --- a/spec/factories/tournaments.rb +++ b/spec/factories/tournaments.rb @@ -12,6 +12,15 @@ 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 }