Chatwoot/spec/factories/conversations.rb
Sojan Jose 4b49d21543
chore: Add event for conversations transferred to Bot (#2167)
* chore:  Event for conversation transferred to Bot

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Nithin David <webofnithin@gmail.com>
2021-04-28 20:53:23 +05:30

20 lines
649 B
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :conversation do
status { 'open' }
agent_last_seen_at { Time.current }
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