chore: Enable email channel (#1851)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
FactoryBot.define do
|
||||
factory :channel_email, class: 'Channel::Email' do
|
||||
sequence(:email) { |n| "care-#{n}@example.com" }
|
||||
sequence(:forward_to_address) { |n| "forward-#{n}@chatwoot.com" }
|
||||
sequence(:forward_to_email) { |n| "forward-#{n}@chatwoot.com" }
|
||||
account
|
||||
after(:create) do |channel_email|
|
||||
create(:inbox, channel: channel_email, account: channel_email.account)
|
||||
|
||||
@@ -29,13 +29,18 @@ RSpec.describe ApplicationMailbox, type: :mailbox do
|
||||
describe 'Support' do
|
||||
let!(:channel_email) { create(:channel_email) }
|
||||
|
||||
before do
|
||||
it 'routes support emails to Support Mailbox when mail is to channel email' do
|
||||
# this email is hardcoded in the support.eml, that's why we are updating this
|
||||
channel_email.email = 'care@example.com'
|
||||
channel_email.save
|
||||
channel_email.update(email: 'care@example.com')
|
||||
dbl = double
|
||||
expect(SupportMailbox).to receive(:new).and_return(dbl)
|
||||
expect(dbl).to receive(:perform_processing).and_return(true)
|
||||
described_class.route support_mail
|
||||
end
|
||||
|
||||
it 'routes support emails to Support Mailbox' do
|
||||
it 'routes support emails to Support Mailbox when mail is to channel forward to email' do
|
||||
# this email is hardcoded in the support.eml, that's why we are updating this
|
||||
channel_email.update(forward_to_email: 'care@example.com')
|
||||
dbl = double
|
||||
expect(SupportMailbox).to receive(:new).and_return(dbl)
|
||||
expect(dbl).to receive(:perform_processing).and_return(true)
|
||||
|
||||
@@ -95,7 +95,7 @@ RSpec.describe ConversationReplyMailer, type: :mailer do
|
||||
let(:conversation) { create(:conversation, assignee: agent, inbox: inbox_member.inbox, account: account) }
|
||||
let!(:message) { create(:message, conversation: conversation, account: account) }
|
||||
let(:mail) { described_class.reply_with_summary(message.conversation, Time.zone.now).deliver_now }
|
||||
let(:domain) { account.domain || ENV.fetch('MAILER_INBOUND_EMAIL_DOMAIN', false) }
|
||||
let(:domain) { account.inbound_email_domain }
|
||||
|
||||
it 'renders the receiver email' do
|
||||
expect(mail.to).to eq([message&.conversation&.contact&.email])
|
||||
|
||||
Reference in New Issue
Block a user