Follow: add flash notice to dossier_controller

This commit is contained in:
Simon Lehericey 2017-07-17 12:28:09 +02:00 committed by Mathieu Magnin
parent 95fbd1824a
commit b80d6a6a59
2 changed files with 5 additions and 0 deletions

View file

@ -11,11 +11,14 @@ module NewGestionnaire
def follow
current_gestionnaire.follow(dossier)
dossier.next_step!('gestionnaire', 'follow')
flash.notice = 'Dossier suivi'
redirect_back(fallback_location: procedures_url)
end
def unfollow
current_gestionnaire.followed_dossiers.delete(dossier)
flash.notice = "Vous ne suivez plus le dossier nº #{dossier.id}"
redirect_back(fallback_location: procedures_url)
end

View file

@ -38,6 +38,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
end
it { expect(gestionnaire.followed_dossiers).to match([dossier]) }
it { expect(flash.notice).to eq('Dossier suivi') }
it { expect(response).to redirect_to(procedures_url) }
end
@ -49,6 +50,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
end
it { expect(gestionnaire.followed_dossiers).to match([]) }
it { expect(flash.notice).to eq("Vous ne suivez plus le dossier nº #{dossier.id}") }
it { expect(response).to redirect_to(procedures_url) }
end