Merge pull request #453 from sgmap/Fix_attestation_attachment_with_remote_storage
Attestation: fix mail attachment when the files are remotely stored
This commit is contained in:
commit
8222a7dc28
2 changed files with 5 additions and 0 deletions
|
@ -131,6 +131,10 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
|
||||
dossier.next_step! 'gestionnaire', next_step, motivation
|
||||
|
||||
# needed to force Carrierwave to provide dossier.attestation.pdf.read
|
||||
# when the Feature.remote_storage is true, otherwise pdf.read is a closed stream.
|
||||
dossier.reload
|
||||
|
||||
attestation_pdf = nil
|
||||
if check_attestation_emailable(dossier)
|
||||
attestation_pdf = dossier.attestation.pdf.read
|
||||
|
|
|
@ -340,6 +340,7 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
allow(attestation).to receive(:pdf).and_return(double(read: 'pdf', size: 2.megabytes))
|
||||
allow(attestation).to receive(:emailable?).and_return(emailable)
|
||||
|
||||
expect_any_instance_of(Dossier).to receive(:reload)
|
||||
allow_any_instance_of(Dossier).to receive(:build_attestation).and_return(attestation)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue