fix dossier link helper

This commit is contained in:
kara Diaby 2021-03-18 12:49:50 +01:00
parent 97e34da1db
commit 64b94100f4
2 changed files with 0 additions and 14 deletions

View file

@ -4,11 +4,6 @@ module DossierLinkHelper
if user.groupe_instructeurs.include?(dossier.groupe_instructeur)
instructeur_dossier_path(dossier.procedure, dossier)
end
elsif user.is_a?(Expert)
avis = dossier.avis.find_by(expert: user.user)
if avis.present?
expert_avis_path(avis.procedure, avis)
end
elsif user.owns_or_invite?(dossier)
dossier_path(dossier)
end

View file

@ -24,15 +24,6 @@ describe DossierLinkHelper do
it { expect(helper.dossier_linked_path(instructeur, dossier)).to eq(instructeur_dossier_path(dossier.procedure, dossier)) }
end
context "when access as expert" do
let(:dossier) { create(:dossier) }
let(:instructeur) { create(:instructeur) }
let(:expert) { create(:expert) }
let!(:experts_procedure) { ExpertsProcedure.create(expert: expert, procedure: dossier.procedure) }
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure) }
it { expect(helper.dossier_linked_path(expert, dossier)).to eq(expert_avis_path(avis.dossier.procedure, avis)) }
end
context "when access as user" do
let(:dossier) { create(:dossier) }
let(:user) { create(:user) }