Chatwoot/spec/factories/conversations.rb
Sojan Jose 2ebd38c3b7
Chore: API Improvements (#2956)
- API to fetch info of a single inbox
- Document passing custom_attributes in the API
- Ability to filter contacts with contact identifier in search API
2021-09-04 17:56:46 +05:30

20 lines
662 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, :with_email, account: conversation.account)
conversation.contact_inbox ||= create(:contact_inbox, contact: conversation.contact, inbox: conversation.inbox)
end
end
end