-FactoryGirl.define do
+FactoryBot.define do
factory :message do
sequence(:title) { |n| "Message #{n}" }
sequence(:body) { |n| "Body text for message #{n}" }
- sent_on Time.now
+ sent_on { Time.now }
- # FIXME: needs user factory
- from_user_id 1
-
- # FIXME: needs user factory
- to_user_id 2
+ association :sender, :factory => :user
+ association :recipient, :factory => :user
trait :unread do
- message_read false
+ message_read { false }
end
trait :read do
- message_read true
+ message_read { true }
end
end
end