2019-10-12 18:08:41 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
|
|
|
factory :conversation do
|
|
|
|
status { 'open' }
|
2019-12-01 04:46:51 +00:00
|
|
|
display_id { rand(10_000_000) }
|
2019-10-12 18:08:41 +00:00
|
|
|
user_last_seen_at { Time.current }
|
|
|
|
agent_last_seen_at { Time.current }
|
|
|
|
locked { false }
|
|
|
|
|
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)
|
|
|
|
)
|
|
|
|
conversation.contact ||= create(:contact, account: conversation.account)
|
2019-10-12 18:08:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|