controllers: disable explicit purge of invalid file
This commit is contained in:
parent
719915e69f
commit
b8706757e3
2 changed files with 1 additions and 7 deletions
|
@ -9,12 +9,6 @@ class Champs::PieceJustificativeController < ApplicationController
|
|||
render :show
|
||||
else
|
||||
errors = @champ.errors.full_messages
|
||||
|
||||
# Before Rails 6, the attachment was persisted to database
|
||||
# by 'attach', even before calling save.
|
||||
# So until we're on Rails 6, we need to purge the file explicitely.
|
||||
@champ.piece_justificative_file.purge_later
|
||||
|
||||
render :json => { errors: errors }, :status => 422
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,7 +44,7 @@ describe Champs::PieceJustificativeController, type: :controller do
|
|||
# See https://github.com/betagouv/demarches-simplifiees.fr/issues/4926
|
||||
before do
|
||||
champ
|
||||
expect_any_instance_of(Champs::PieceJustificativeChamp).to receive(:save).and_return(false)
|
||||
expect_any_instance_of(Champs::PieceJustificativeChamp).to receive(:save).twice.and_return(false)
|
||||
expect_any_instance_of(Champs::PieceJustificativeChamp).to receive(:errors)
|
||||
.and_return(double(full_messages: ['La pièce justificative n’est pas d’un type accepté']))
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue