otwarchive-symphonyarchive/factories/chapters.rb
2026-03-11 22:22:11 +00:00

24 lines
427 B
Ruby

require 'faker'
FactoryBot.define do
factory :chapter do
content { "Awesome content!" }
work
posted { true }
transient do
authors { work.pseuds }
end
after(:build) do |chapter, evaluator|
evaluator.authors.each do |pseud|
chapter.creatorships.build(pseud: pseud)
end
end
trait :draft do
content { "Draft content!" }
posted { false }
end
end
end