fix: html content is available and mail_part empty (#3964)

This commit is contained in:
Tejaswini Chile
2022-02-14 20:22:58 +05:30
committed by GitHub
parent f34a2e6115
commit de4e4c6f65
3 changed files with 183 additions and 9 deletions

View File

@@ -156,5 +156,28 @@ RSpec.describe SupportMailbox, type: :mailbox do
expect(conversation_1.messages.count).to eq(2)
end
end
describe 'when mail part is not present' do
let(:support_mail) { create_inbound_email_from_fixture('support_1.eml') }
let(:described_subject) { described_class.receive support_mail }
it 'Considers raw html mail body' do
described_subject
expect(conversation.inbox.id).to eq(channel_email.inbox.id)
expect(conversation.messages.last.content).to include(
<<-BODY.strip_heredoc.chomp
Hi,
We are providing you platform from here you can sellpaid posts on your website.
Chatwoot | CS team | [C](https://d33wubrfki0l68.cloudfront.net/973467c532160fd8b940300a43fa85fa2d060307/dc9a0/static/brand-73f58cdefae282ae74cebfa74c1d7003.svg)
Skype: live:.cid.something
[]
BODY
)
expect(conversation.messages.last.content_attributes['email']['subject']).to eq('Get Paid to post an article')
end
end
end
end