refactor(instructeur): use better fallback location

This commit is contained in:
Paul Chavard 2022-03-11 13:55:36 +01:00
parent bc4ff661ad
commit 78bf1147d0
2 changed files with 8 additions and 8 deletions

View file

@ -96,24 +96,24 @@ module Instructeurs
def follow
current_instructeur.follow(dossier)
flash.notice = 'Dossier suivi'
redirect_back(fallback_location: instructeur_procedures_url)
redirect_back(fallback_location: instructeur_procedure_path(procedure))
end
def unfollow
current_instructeur.unfollow(dossier)
flash.notice = "Vous ne suivez plus le dossier nº #{dossier.id}"
redirect_back(fallback_location: instructeur_procedures_url)
redirect_back(fallback_location: instructeur_procedure_path(procedure))
end
def archive
dossier.archiver!(current_instructeur)
redirect_back(fallback_location: instructeur_procedures_url)
redirect_back(fallback_location: instructeur_procedure_path(procedure))
end
def unarchive
dossier.desarchiver!(current_instructeur)
redirect_back(fallback_location: instructeur_procedures_url)
redirect_back(fallback_location: instructeur_procedure_path(procedure))
end
def passer_en_instruction

View file

@ -56,7 +56,7 @@ describe Instructeurs::DossiersController, type: :controller do
it { expect(instructeur.followed_dossiers).to match([dossier]) }
it { expect(flash.notice).to eq('Dossier suivi') }
it { expect(response).to redirect_to(instructeur_procedures_url) }
it { expect(response).to redirect_to(instructeur_procedure_path(dossier.procedure)) }
end
describe '#unfollow' do
@ -68,7 +68,7 @@ describe Instructeurs::DossiersController, type: :controller do
it { expect(instructeur.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(instructeur_procedures_url) }
it { expect(response).to redirect_to(instructeur_procedure_path(dossier.procedure)) }
end
describe '#archive' do
@ -80,7 +80,7 @@ describe Instructeurs::DossiersController, type: :controller do
end
it { expect(dossier.archived).to be true }
it { expect(response).to redirect_to(instructeur_procedures_url) }
it { expect(response).to redirect_to(instructeur_procedure_path(dossier.procedure)) }
end
describe '#unarchive' do
@ -91,7 +91,7 @@ describe Instructeurs::DossiersController, type: :controller do
end
it { expect(dossier.archived).to be false }
it { expect(response).to redirect_to(instructeur_procedures_url) }
it { expect(response).to redirect_to(instructeur_procedure_path(dossier.procedure)) }
end
describe '#passer_en_instruction' do