DossierController: a archived dossier is not followed

This commit is contained in:
Simon Lehericey 2017-09-25 18:13:10 +02:00
parent 19b3416361
commit e20d403b20
2 changed files with 4 additions and 0 deletions

View file

@ -40,6 +40,7 @@ module NewGestionnaire
def archive
dossier.update_attributes(archived: true)
current_gestionnaire.unfollow(dossier)
redirect_back(fallback_location: procedures_url)
end

View file

@ -55,12 +55,15 @@ describe NewGestionnaire::DossiersController, type: :controller do
describe '#archive' do
before do
gestionnaire.follow(dossier)
patch :archive, params: { procedure_id: procedure.id, dossier_id: dossier.id }
dossier.reload
gestionnaire.reload
end
it { expect(dossier.archived).to be true }
it { expect(response).to redirect_to(procedures_url) }
it { expect(gestionnaire.followed_dossiers).not_to include(dossier) }
end
describe '#unarchive' do