2017-12-12 16:44:30 +01:00
|
|
|
describe DossierLinkHelper do
|
|
|
|
describe "#dossier_linked_path" do
|
|
|
|
context "when no access" do
|
|
|
|
let(:gestionnaire) { create(:gestionnaire) }
|
|
|
|
let(:dossier) { create(:dossier) }
|
|
|
|
|
|
|
|
it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to be_nil }
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when access as gestionnaire" do
|
2018-01-15 22:10:46 +01:00
|
|
|
let(:dossier) { create(:dossier) }
|
2017-12-12 16:44:30 +01:00
|
|
|
let(:gestionnaire) { create(:gestionnaire) }
|
|
|
|
|
|
|
|
before { dossier.procedure.gestionnaires << gestionnaire }
|
|
|
|
|
|
|
|
it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(dossier_path(dossier.procedure, dossier)) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when access as expert" do
|
2018-01-15 22:10:46 +01:00
|
|
|
let(:dossier) { create(:dossier) }
|
2017-12-12 16:44:30 +01:00
|
|
|
let(:gestionnaire) { create(:gestionnaire) }
|
|
|
|
let!(:avis) { create(:avis, dossier: dossier, gestionnaire: gestionnaire) }
|
|
|
|
|
|
|
|
it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(avis_path(avis)) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|