Static attributes are deprecated since factory bot 4.11; we haven't upgraded yet but now we're ready to do so: https://thoughtbot.com/blog/deprecating-static-attributes-in-factory_bot-4-11
29 lines
602 B
Ruby
29 lines
602 B
Ruby
FactoryBot.define do
|
|
factory :tag, class: "ActsAsTaggableOn::Tag" do
|
|
sequence(:name) { |n| "Tag #{n} name" }
|
|
|
|
trait :category do
|
|
kind { "category" }
|
|
end
|
|
|
|
trait :milestone do
|
|
kind { "milestone" }
|
|
end
|
|
end
|
|
|
|
factory :tagging, class: "ActsAsTaggableOn::Tagging" do
|
|
context { "tags" }
|
|
association :taggable, factory: :proposal
|
|
tag
|
|
end
|
|
|
|
factory :topic do
|
|
sequence(:title) { |n| "Topic title #{n}" }
|
|
sequence(:description) { |n| "Description as comment #{n}" }
|
|
association :author, factory: :user
|
|
end
|
|
|
|
factory :related_content do
|
|
end
|
|
end
|