|
@@ -24,7 +24,7 @@ RSpec.describe Trigger, type: :model do
|
|
|
'notification.email' => {
|
|
|
'recipient' => 'ticket_customer',
|
|
|
'subject' => 'foo',
|
|
|
- 'body' => 'bar'
|
|
|
+ 'body' => 'some body with >snip<#{article.body_as_html}>/snip<', # rubocop:disable Lint/InterpolationCheck
|
|
|
}
|
|
|
}
|
|
|
end
|
|
@@ -56,6 +56,42 @@ RSpec.describe Trigger, type: :model do
|
|
|
expect(Ticket.last.state.name).to eq('new')
|
|
|
end
|
|
|
end
|
|
|
+
|
|
|
+ context 'when ticket is created via Channel::EmailParser.process with inline image' do
|
|
|
+ before { create(:email_address, groups: [Group.first]) }
|
|
|
+ let(:raw_email) { File.read(Rails.root.join('test', 'data', 'mail', 'mail010.box')) }
|
|
|
+
|
|
|
+ it 'fires (without altering ticket state)' do
|
|
|
+ expect { Channel::EmailParser.new.process({}, raw_email) }
|
|
|
+ .to change { Ticket.count }.by(1)
|
|
|
+ .and change { Ticket::Article.count }.by(2)
|
|
|
+
|
|
|
+ expect(Ticket.last.state.name).to eq('new')
|
|
|
+
|
|
|
+ article = Ticket::Article.last
|
|
|
+ expect(article.type.name).to eq('email')
|
|
|
+ expect(article.sender.name).to eq('System')
|
|
|
+ expect(article.attachments.count).to eq(1)
|
|
|
+ expect(article.attachments[0].filename).to eq('image001.jpg')
|
|
|
+ expect(article.attachments[0].preferences['Content-ID']).to eq('image001.jpg@01CDB132.D8A510F0')
|
|
|
+
|
|
|
+ expect(article.body).to eq(<<~RAW.chomp
|
|
|
+ some body with >snip<<div>
|
|
|
+ <p>Herzliche Grüße aus Oberalteich sendet Herrn Smith</p>
|
|
|
+ <p> </p>
|
|
|
+ <p>Sepp Smith - Dipl.Ing. agr. (FH)</p>
|
|
|
+ <p>Geschäftsführer der example Straubing-Bogen</p>
|
|
|
+ <p>Klosterhof 1 | 94327 Bogen-Oberalteich</p>
|
|
|
+ <p>Tel: 09422-505601 | Fax: 09422-505620</p>
|
|
|
+ <p>Internet: <a href="http://example-straubing-bogen.de/" rel="nofollow noreferrer noopener" target="_blank">http://example-straubing-bogen.de</a></p>
|
|
|
+ <p>Facebook: <a href="http://facebook.de/examplesrbog" rel="nofollow noreferrer noopener" target="_blank">http://facebook.de/examplesrbog</a></p>
|
|
|
+ <p><b><img border="0" src="cid:image001.jpg@01CDB132.D8A510F0" alt="Beschreibung: Beschreibung: efqmLogo" style="width:60px;height:19px;"></b><b> - European Foundation für Quality Management</b></p>
|
|
|
+ <p> </p>
|
|
|
+ </div>>/snip<
|
|
|
+ RAW
|
|
|
+ )
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
context 'for condition "ticket updated"' do
|