chore(attestation): publish a v2 attestation

This commit is contained in:
Colin Darie 2024-05-28 17:47:05 +02:00
parent 4af6957237
commit 11d29f5574
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
8 changed files with 98 additions and 41 deletions

View file

@ -81,7 +81,7 @@ describe 'As an administrateur, I want to manage the procedures attestation',
find("a").click
end
expect(procedure.reload.attestation_template_v2).to be_nil
expect(procedure.reload.attestation_templates.v2).to be_empty
expect(page).to have_css("label", text: "Logo additionnel")
@ -90,7 +90,7 @@ describe 'As an administrateur, I want to manage the procedures attestation',
attestation = nil
wait_until {
attestation = procedure.reload.attestation_template_v2
attestation = procedure.reload.attestation_templates.v2.draft.first
attestation.present?
}
expect(attestation.label_logo).to eq("System Test")
@ -130,6 +130,10 @@ describe 'As an administrateur, I want to manage the procedures attestation',
fill_in "Contenu du pied de page", with: ["line1", "line2", "line3", "line4"].join("\n")
expect(page).to have_field("Contenu du pied de page", with: "line1\nline2\nline3\nline4")
click_on "Publier"
expect(page).to have_text("Lattestation a été publiée")
expect(attestation.reload).to be_published
end
context "tag in error" do
@ -137,7 +141,7 @@ describe 'As an administrateur, I want to manage the procedures attestation',
tdc = procedure.active_revision.add_type_de_champ(type_champ: :integer_number, libelle: 'age')
procedure.publish_revision!
attestation = procedure.build_attestation_template_v2(json_body: AttestationTemplate::TIPTAP_BODY_DEFAULT, label_logo: "test")
attestation = procedure.build_attestation_template(version: 2, json_body: AttestationTemplate::TIPTAP_BODY_DEFAULT, label_logo: "test")
attestation.json_body["content"] << { type: :mention, attrs: { id: "tdc#{tdc.stable_id}", label: tdc.libelle } }
attestation.save!