Add a tournament with stages to factory
This commit is contained in:
parent
1c318cde1a
commit
fbb87f5f7c
|
|
@ -5,5 +5,19 @@ FactoryBot.define do
|
||||||
name { Faker::Dog.name }
|
name { Faker::Dog.name }
|
||||||
description { Faker::Lorem.sentence }
|
description { Faker::Lorem.sentence }
|
||||||
user
|
user
|
||||||
|
transient do
|
||||||
|
teams_count { 16 }
|
||||||
|
end
|
||||||
|
after(:create) do |tournament, evaluator|
|
||||||
|
tournament.teams = create_list(:team, evaluator.teams_count, tournament: tournament)
|
||||||
|
end
|
||||||
|
factory :stage_tournament do
|
||||||
|
transient do
|
||||||
|
stage_count { 1 }
|
||||||
|
end
|
||||||
|
after(:create) do |tournament, evaluator|
|
||||||
|
tournament.stages = create_list(:stage, evaluator.stage_count)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue