feat(CommentaireService.soft_delete): ensure it purge piece_jointe later
This commit is contained in:
parent
9a8ec1087c
commit
c7bfd1af04
1 changed files with 10 additions and 1 deletions
|
@ -77,12 +77,21 @@ describe CommentaireService do
|
|||
context 'when commentaire belongs to instructeur' do
|
||||
let(:user) { create(:instructeur) }
|
||||
let(:dossier) { create(:dossier) }
|
||||
let(:commentaire) { create(:commentaire, dossier: dossier, instructeur: user) }
|
||||
let(:commentaire) do
|
||||
create(:commentaire,
|
||||
dossier: dossier,
|
||||
instructeur: user,
|
||||
piece_jointe: fixture_file_upload('spec/fixtures/files/piece_justificative_0.pdf', 'application/pdf'))
|
||||
end
|
||||
let(:params) { { dossier_id: dossier.id,
|
||||
commentaire_id: commentaire.id } }
|
||||
it 'returns error struct' do
|
||||
expect(subject.status).to eq(true)
|
||||
end
|
||||
it 'sets commentaire.body to deleted message' do
|
||||
allow(commentaire.piece_jointe).to receive(:purge_later)
|
||||
expect{ subject}.to change { commentaire.reload.body}.from(an_instance_of(String)).to("Message supprimé")
|
||||
end
|
||||
it 'sets commentaire.body to deleted message' do
|
||||
expect{ subject}.to change { commentaire.reload.body}.from(an_instance_of(String)).to("Message supprimé")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue