fix(attestation): don't delete v1 published when building a v2
This commit is contained in:
parent
d609b6b71f
commit
5e25547b7b
2 changed files with 2 additions and 1 deletions
|
@ -130,7 +130,7 @@ module Administrateurs
|
|||
|
||||
def build_default_attestation
|
||||
state = should_edit_draft? ? :draft : :published
|
||||
@procedure.build_attestation_template(version: 2, json_body: AttestationTemplate::TIPTAP_BODY_DEFAULT, activated: true, state:)
|
||||
@procedure.attestation_templates.build(version: 2, json_body: AttestationTemplate::TIPTAP_BODY_DEFAULT, activated: true, state:)
|
||||
end
|
||||
|
||||
def should_edit_draft? = !@procedure.brouillon?
|
||||
|
|
|
@ -140,6 +140,7 @@ describe Administrateurs::AttestationTemplateV2sController, type: :controller do
|
|||
subject
|
||||
expect(assigns(:attestation_template).version).to eq(2)
|
||||
expect(assigns(:attestation_template)).to be_draft
|
||||
expect(attestation_template.reload).to be_present
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue