Add multiple factories
This commit is contained in:
parent
6811c9e7eb
commit
3fc344249d
|
|
@ -2,7 +2,15 @@
|
||||||
|
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :group do
|
factory :group do
|
||||||
|
transient do
|
||||||
|
match_count { 4 }
|
||||||
|
end
|
||||||
|
|
||||||
sequence(:number)
|
sequence(:number)
|
||||||
stage
|
stage
|
||||||
|
|
||||||
|
after(:create) do |group, evaluator|
|
||||||
|
create_list(:group_match, evaluator.match_count, group: group)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,14 @@
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :stage do
|
factory :stage do
|
||||||
tournament
|
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
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ FactoryBot.define do
|
||||||
after(:create) do |tournament, evaluator|
|
after(:create) do |tournament, evaluator|
|
||||||
tournament.teams = create_list(:team, evaluator.teams_count, tournament: tournament)
|
tournament.teams = create_list(:team, evaluator.teams_count, tournament: tournament)
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :stage_tournament do
|
factory :stage_tournament do
|
||||||
transient do
|
transient do
|
||||||
stage_count { 1 }
|
stage_count { 1 }
|
||||||
|
|
@ -19,5 +20,11 @@ FactoryBot.define do
|
||||||
tournament.stages = create_list(:stage, evaluator.stage_count)
|
tournament.stages = create_list(:stage, evaluator.stage_count)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
factory :group_stage_tournament do
|
||||||
|
after(:create) do |tournament, _evaluator|
|
||||||
|
tournament.stages = create_list(:group_stage, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue