mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
21 lines
483 B
Ruby
21 lines
483 B
Ruby
FactoryBot.define do
|
|
factory :forum do
|
|
sequence(:title) { |n| "Forum Title #{n}" }
|
|
sequence(:description) { |n| "Forum Description #{n}" }
|
|
|
|
before :create do |forum|
|
|
cat = create(:category, :forums)
|
|
forum.category = cat
|
|
end
|
|
|
|
trait :with_content do
|
|
after :create do |forum|
|
|
(rand(30..100)).times do
|
|
topic = build :topic, :with_content
|
|
topic.forum = forum
|
|
topic.save
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|