Chatwoot/spec/factories/conversations.rb
Nithin David Thomas 49db9c5d8a
Adds unread message bubbles for widget (#943)
Co-authored-by: Sojan <sojan@pepalo.com>
Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
2020-07-08 00:04:44 +05:30

22 lines
706 B
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :conversation do
status { 'open' }
display_id { rand(10_000_000) }
agent_last_seen_at { Time.current }
locked { false }
identifier { SecureRandom.hex }
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)
conversation.contact_inbox ||= create(:contact_inbox, contact: conversation.contact, inbox: conversation.inbox)
end
end
end