Fix: Find mailbox with cc email (#4372)

This commit is contained in:
Tejaswini Chile
2022-04-08 11:20:19 +05:30
committed by GitHub
parent 14e6a5d6b0
commit 57359be37e
9 changed files with 103 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ RSpec.describe ApplicationMailbox, type: :mailbox do
describe 'route the inbound mail to appropriate mailbox' do
let(:welcome_mail) { create_inbound_email_from_fixture('welcome.eml') }
let(:reply_mail) { create_inbound_email_from_fixture('reply.eml') }
let(:reply_cc_mail) { create_inbound_email_from_fixture('reply_cc.eml') }
let(:reply_mail_without_uuid) { create_inbound_email_from_fixture('reply.eml') }
let(:reply_mail_with_in_reply_to) { create_inbound_email_from_fixture('in_reply_to.eml') }
let(:support_mail) { create_inbound_email_from_fixture('support.eml') }
@@ -55,6 +56,14 @@ RSpec.describe ApplicationMailbox, type: :mailbox do
expect(dbl).to receive(:perform_processing).and_return(true)
described_class.route support_mail
end
it 'routes support emails to Support Mailbox with cc email' do
channel_email.update(email: 'test@example.com')
dbl = double
expect(SupportMailbox).to receive(:new).and_return(dbl)
expect(dbl).to receive(:perform_processing).and_return(true)
described_class.route reply_cc_mail
end
end
end
end

View File

@@ -148,6 +148,7 @@ RSpec.describe SupportMailbox, type: :mailbox do
expect(conversation_1.messages.count).to eq(1)
reply_mail_without_uuid.mail['In-Reply-To'] = 'conversation/6bdc3f4d-0bec-4515-a284-5d916fdde489/messages/123'
reply_mail_without_uuid.mail['Message-Id'] = '0CB459E0-0336-41DA-BC88-E6E28C697SFC@chatwoot.com'
described_class.receive reply_mail_without_uuid