[Fix #196] Attestation: join the attestation to the closed mail
Add a upper limit to the attachment size as it could be a problem with Mailjet and receiver (https://www.mailjet.com/support/what-is-the-size-limit-for-attachments-files-sent-via-mailjet,289.htm) If the attestation cannot be sent, it is logged in sentry
This commit is contained in:
parent
b664709c3d
commit
e60ce35ae8
7 changed files with 114 additions and 18 deletions
|
@ -5,11 +5,25 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
let(:user) { create(:user) }
|
||||
let(:dossier) { create(:dossier, user: user) }
|
||||
let(:email) { instance_double('email', object_for_dossier: 'object', body_for_dossier: 'body') }
|
||||
let (:notifications_count_before) { Notification.count }
|
||||
subject { described_class.send_notification(dossier, email) }
|
||||
let(:attestation) { nil }
|
||||
let(:notifications_count_before) { Notification.count }
|
||||
|
||||
subject { described_class.send_notification(dossier, email, attestation) }
|
||||
|
||||
it { expect(subject.subject).to eq(email.object_for_dossier) }
|
||||
it { expect(subject.body).to eq(email.body_for_dossier) }
|
||||
it { expect(subject.attachments['attestation.pdf']).to eq(nil) }
|
||||
|
||||
context 'when an attestation is provided' do
|
||||
let(:attestation) { 'attestation' }
|
||||
|
||||
it do
|
||||
expect(subject.attachments['attestation.pdf'].content_type)
|
||||
.to eq('application/pdf; filename=attestation.pdf')
|
||||
|
||||
expect(subject.attachments['attestation.pdf'].body).to eq('attestation')
|
||||
end
|
||||
end
|
||||
|
||||
it "creates a commentaire, which is not notified" do
|
||||
described_class.send_notification(dossier, email).deliver_now
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue