Make dossier link clickable for users in the Demande tab

This commit is contained in:
gregoirenovel 2018-12-28 17:22:51 +01:00
parent cc07f0d701
commit b4781f7440
3 changed files with 29 additions and 9 deletions

View file

@ -1,12 +1,19 @@
describe DossierLinkHelper do
describe "#dossier_linked_path" do
context "when no access" do
context "when no access as a gestionnaire" do
let(:gestionnaire) { create(:gestionnaire) }
let(:dossier) { create(:dossier) }
it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to be_nil }
end
context "when no access as a user" do
let(:user) { create(:user) }
let(:dossier) { create(:dossier) }
it { expect(helper.dossier_linked_path(user, dossier)).to be_nil }
end
context "when access as gestionnaire" do
let(:dossier) { create(:dossier) }
let(:gestionnaire) { create(:gestionnaire) }
@ -23,5 +30,14 @@ describe DossierLinkHelper do
it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(gestionnaire_avis_path(avis)) }
end
context "when access as user" do
let(:dossier) { create(:dossier) }
let(:user) { create(:user) }
before { dossier.user = user }
it { expect(helper.dossier_linked_path(user, dossier)).to eq(dossier_path(dossier)) }
end
end
end