[#1110] Make processed_at date available for attestation generation

This commit is contained in:
Frederic Merizen 2017-12-22 11:31:38 +01:00
parent 4805e4a5b2
commit 6a85094e1a
4 changed files with 12 additions and 4 deletions

View file

@ -123,8 +123,8 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
notice = "Dossier considéré comme sans suite." notice = "Dossier considéré comme sans suite."
template = dossier.procedure.without_continuation_mail_template template = dossier.procedure.without_continuation_mail_template
when "close" when "close"
dossier.attestation = dossier.build_attestation
dossier.accepte! dossier.accepte!
dossier.attestation = dossier.build_attestation
notice = "Dossier traité avec succès." notice = "Dossier traité avec succès."
template = dossier.procedure.closed_mail_template template = dossier.procedure.closed_mail_template
end end

View file

@ -89,8 +89,8 @@ module NewGestionnaire
notice = "Dossier considéré comme sans suite." notice = "Dossier considéré comme sans suite."
template = procedure.without_continuation_mail_template template = procedure.without_continuation_mail_template
when "accepter" when "accepter"
dossier.attestation = dossier.build_attestation
dossier.accepte! dossier.accepte!
dossier.attestation = dossier.build_attestation
notice = "Dossier traité avec succès." notice = "Dossier traité avec succès."
template = procedure.closed_mail_template template = procedure.closed_mail_template
end end

View file

@ -358,11 +358,15 @@ describe Backoffice::DossiersController, type: :controller do
subject { post :process_dossier, params: { process_action: "close", dossier_id: dossier_id, dossier: { motivation: "Yallah" }}} subject { post :process_dossier, params: { process_action: "close", dossier_id: dossier_id, dossier: { motivation: "Yallah" }}}
before do before do
Timecop.freeze(DateTime.now)
expect_any_instance_of(AttestationTemplate) expect_any_instance_of(AttestationTemplate)
.to receive(:attestation_for) .to receive(:attestation_for)
.with(have_attributes(motivation: "Yallah")) .with(have_attributes(motivation: "Yallah", processed_at: DateTime.now))
end end
after { Timecop.return }
it { subject } it { subject }
end end
end end

View file

@ -237,11 +237,15 @@ describe NewGestionnaire::DossiersController, type: :controller do
end end
before do before do
Timecop.freeze(DateTime.now)
expect_any_instance_of(AttestationTemplate) expect_any_instance_of(AttestationTemplate)
.to receive(:attestation_for) .to receive(:attestation_for)
.with(have_attributes(motivation: "Yallah")) .with(have_attributes(motivation: "Yallah", processed_at: DateTime.now))
end end
after { Timecop.return }
it { subject } it { subject }
end end
end end