Merge pull request #10573 from colinux/fix-attestation-v2-eraser
ETQ admin, ne détruit pas l'attestation v1 en allant sur la page pour préparer une v2
This commit is contained in:
commit
a4852bff3d
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