2019-10-12 18:08:41 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
|
|
|
factory :conversation do
|
|
|
|
status { 'open' }
|
|
|
|
agent_last_seen_at { Time.current }
|
2020-06-12 17:42:47 +00:00
|
|
|
identifier { SecureRandom.hex }
|
2019-10-12 18:08:41 +00:00
|
|
|
|
2019-12-24 07:57:25 +00:00
|
|
|
after(:build) do |conversation|
|
|
|
|
conversation.account ||= create(:account)
|
|
|
|
conversation.inbox ||= create(
|
|
|
|
:inbox,
|
|
|
|
account: conversation.account,
|
|
|
|
channel: create(:channel_widget, account: conversation.account)
|
|
|
|
)
|
2021-09-04 12:26:46 +00:00
|
|
|
conversation.contact ||= create(:contact, :with_email, account: conversation.account)
|
2020-01-09 07:36:40 +00:00
|
|
|
conversation.contact_inbox ||= create(:contact_inbox, contact: conversation.contact, inbox: conversation.inbox)
|
2019-10-12 18:08:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|