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
26 lines
783 B
Ruby
26 lines
783 B
Ruby
FactoryBot.define do
|
|
factory :milestone_status, class: "Milestone::Status" do
|
|
sequence(:name) { |n| "Milestone status #{n} name" }
|
|
sequence(:description) { |n| "Milestone status #{n} description" }
|
|
end
|
|
|
|
factory :milestone do
|
|
association :milestoneable, factory: :budget_investment
|
|
association :status, factory: :milestone_status
|
|
sequence(:title) { |n| "Milestone #{n} title" }
|
|
description { "Milestone description" }
|
|
publication_date { Date.current }
|
|
end
|
|
|
|
factory :progress_bar do
|
|
association :progressable, factory: :budget_investment
|
|
percentage { rand(0..100) }
|
|
kind { :primary }
|
|
|
|
trait(:secondary) do
|
|
kind { :secondary }
|
|
sequence(:title) { |n| "Progress bar #{n} title" }
|
|
end
|
|
end
|
|
end
|