Add group_stage_only_tournament factory

This commit is contained in:
Daniel Schädler 2019-05-10 23:13:12 +02:00
parent 03d7369a1c
commit dcb19461be
2 changed files with 10 additions and 1 deletions

View File

@ -13,7 +13,7 @@ RSpec.describe StatisticsController, type: :controller do
context 'tournament with a group stage' do context 'tournament with a group stage' do
before do before do
@tournament = create(:group_stage_tournament) @tournament = create(:group_stage_only_tournament)
@group_stage = @tournament.stages.find_by(level: -1) @group_stage = @tournament.stages.find_by(level: -1)
@most_dominant_score = create(:group_score, @most_dominant_score = create(:group_score,
team: @tournament.teams.first, team: @tournament.teams.first,

View File

@ -12,6 +12,15 @@ FactoryBot.define do
tournament.teams = create_list(:team, evaluator.teams_count, tournament: tournament) tournament.teams = create_list(:team, evaluator.teams_count, tournament: tournament)
end 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 factory :stage_tournament do
transient do transient do
stage_count { 1 } stage_count { 1 }