e60ce35ae8
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
23 lines
584 B
Ruby
23 lines
584 B
Ruby
RSpec.describe Attestation, type: :model do
|
|
describe 'emailable' do
|
|
let(:attestation) do
|
|
attestation = Attestation.new
|
|
expect(attestation).to receive(:pdf).and_return(double(size: size))
|
|
attestation
|
|
end
|
|
|
|
subject { attestation.emailable? }
|
|
|
|
context 'when the pdf size is acceptable' do
|
|
let(:size) { Attestation::MAX_SIZE_EMAILABLE }
|
|
|
|
it { is_expected.to be true }
|
|
end
|
|
|
|
context 'when the pdf size is unacceptable' do
|
|
let(:size) { Attestation::MAX_SIZE_EMAILABLE + 1 }
|
|
|
|
it { is_expected.to be false }
|
|
end
|
|
end
|
|
end
|