Add :undecided_group_match and :decided_playoff_match

This commit is contained in:
Daniel Schädler 2019-05-13 11:53:09 +02:00
parent a480cf3180
commit 002f59ecd8
1 changed files with 23 additions and 2 deletions

View File

@ -10,7 +10,18 @@ FactoryBot.define do
after(:create) do |match, evaluator|
match.match_scores = create_list(:match_score, evaluator.match_scores_count)
end
state { 3 }
state { :in_progress }
end
factory :decided_playoff_match do
transient do
match_scores_count { 2 }
end
after(:create) do |match, evaluator|
match.match_scores = create_list(:match_score, evaluator.match_scores_count, points: rand(10))
match.match_scores.first.points += 1
end
state { :finished }
end
end
@ -23,7 +34,17 @@ FactoryBot.define do
after(:create) do |match, evaluator|
match.match_scores = create_list(:match_score, evaluator.match_scores_count)
end
state { 3 }
state { :in_progress }
end
factory :undecided_group_match do
transient do
match_scores_count { 2 }
end
after(:create) do |match, evaluator|
match.match_scores = create_list(:match_score, evaluator.match_scores_count, points: 3)
end
state { :finished }
end
end
end