[Fix #499] Attestation: add maxlength to footer

This commit is contained in:
Simon Lehericey 2017-06-27 13:07:06 +02:00
parent 81984d2883
commit 3d99407495
4 changed files with 21 additions and 1 deletions

View file

@ -40,6 +40,21 @@ describe AttestationTemplate, type: :model do
end
end
describe 'validates footer length' do
let(:attestation_template) { AttestationTemplate.new(footer: footer) }
subject do
attestation_template.validate
attestation_template.errors.details
end
context 'when the footer is too long' do
let(:footer) { 'a' * 191 }
it { is_expected.to match({ footer: [{ error: :too_long, count: 190 }] }) }
end
end
describe 'dup' do
before do
@logo = File.open('spec/fixtures/white.png')