Chatwoot/spec/factories/conversations.rb
Sojan Jose 722f540b03 [Feature] Email collect message hooks (#331)
- Add email collect hook on creating conversation
- Merge contact if it already exist
2020-01-09 13:06:40 +05:30

22 lines
709 B
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :conversation do
status { 'open' }
display_id { rand(10_000_000) }
user_last_seen_at { Time.current }
agent_last_seen_at { Time.current }
locked { false }
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