[Fix #1143] Set motivation before generating attestation
This commit is contained in:
parent
d222c707f5
commit
2ae67a44f2
4 changed files with 42 additions and 13 deletions
|
@ -349,6 +349,22 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the attestation template uses the motivation field', focus: true do
|
||||
let(:emailable) { false }
|
||||
let(:template) { create(:attestation_template) }
|
||||
let(:procedure) { create(:procedure, :published, attestation_template: template, gestionnaires: [gestionnaire]) }
|
||||
|
||||
subject { post :process_dossier, params: { process_action: "close", dossier_id: dossier_id, dossier: { motivation: "Yallah" }}}
|
||||
|
||||
before do
|
||||
expect_any_instance_of(AttestationTemplate)
|
||||
.to receive(:attestation_for)
|
||||
.with(have_attributes(motivation: "Yallah"))
|
||||
end
|
||||
|
||||
it { subject }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -223,6 +223,27 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the attestation template uses the motivation field', focus: true do
|
||||
let(:emailable) { false }
|
||||
let(:template) { create(:attestation_template) }
|
||||
let(:procedure) { create(:procedure, :published, attestation_template: template, gestionnaires: [gestionnaire]) }
|
||||
|
||||
subject do
|
||||
post :terminer, params: { process_action: "accepter",
|
||||
procedure_id: procedure.id,
|
||||
dossier_id: dossier.id,
|
||||
dossier: { motivation: "Yallah" }}
|
||||
end
|
||||
|
||||
before do
|
||||
expect_any_instance_of(AttestationTemplate)
|
||||
.to receive(:attestation_for)
|
||||
.with(have_attributes(motivation: "Yallah"))
|
||||
end
|
||||
|
||||
it { subject }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue