fix(attestation): dup keep all attributes

This commit is contained in:
Colin Darie 2024-05-28 16:22:47 +02:00
parent c5c24c01d8
commit 4af6957237
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
2 changed files with 6 additions and 4 deletions

View file

@ -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

View file

@ -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