Files
nairobi/spec/factories/notifications.rb
Javi Martín 614b4fbe4c Add and apply FactoryBot/AssociationStyle rule
This rule was added in rubocop-factory_bot 2.23.0. We were following it
sometimes, and sometimes we were not.
2023-09-08 13:52:54 +02:00

37 lines
806 B
Ruby

FactoryBot.define do
factory :notification do
user
notifiable factory: :proposal
trait :read do
read_at { Time.current }
end
trait :for_proposal_notification do
notifiable factory: :proposal_notification
end
trait :for_comment do
notifiable factory: :comment
end
trait :for_poll_question do
notifiable factory: :poll_question
end
end
factory :admin_notification do
sequence(:title) { |n| "Admin Notification title #{n}" }
sequence(:body) { |n| "Admin Notification body #{n}" }
link { nil }
segment_recipient { UserSegments.segments.sample }
recipients_count { nil }
sent_at { nil }
trait :sent do
recipients_count { 1 }
sent_at { Time.current }
end
end
end