diff --git a/app/models/attestation_template.rb b/app/models/attestation_template.rb index f415e8e8b..4c542b939 100644 --- a/app/models/attestation_template.rb +++ b/app/models/attestation_template.rb @@ -96,7 +96,7 @@ class AttestationTemplate < ApplicationRecord end def dup - attestation_template = AttestationTemplate.new(title: title, body: body, footer: footer, activated: activated) + attestation_template = super ClonePiecesJustificativesService.clone_attachments(self, attestation_template) attestation_template end diff --git a/spec/models/attestation_template_spec.rb b/spec/models/attestation_template_spec.rb index 638da8b4f..2807b3f64 100644 --- a/spec/models/attestation_template_spec.rb +++ b/spec/models/attestation_template_spec.rb @@ -21,9 +21,11 @@ describe AttestationTemplate, type: :model do context 'with an attestation without images' do let(:attributes) { attributes_for(:attestation_template) } - it { is_expected.to have_attributes(attributes) } - it { is_expected.to have_attributes(id: nil) } - it { expect(subject.logo.attached?).to be_falsey } + it "works" do + is_expected.to have_attributes(attributes) + is_expected.to have_attributes(id: nil) + expect(subject.logo.attached?).to be_falsey + end end context 'with an attestation with images' do