From 4380fecd7359675a4864aa2224cefd8cb64ab4f8 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 14 Dec 2023 10:07:34 +0100 Subject: [PATCH] =?UTF-8?q?amelioration(expert.sign-in):=20ETQ=20expert,?= =?UTF-8?q?=20je=20suis=20redirig=C3=A9=20vers=20la=20page=20listant=20les?= =?UTF-8?q?=20avis=20a=20donner=20ap=20connexion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/root_controller.rb | 2 ++ spec/controllers/root_controller_spec.rb | 10 ++++++++++ spec/system/experts/expert_spec.rb | 7 +++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 588c8c2df..6deb4cf13 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -6,6 +6,8 @@ class RootController < ApplicationController return redirect_to admin_procedures_path elsif instructeur_signed_in? return redirect_to instructeur_procedures_path + elsif expert_signed_in? + return redirect_to expert_all_avis_path elsif user_signed_in? return redirect_to dossiers_path elsif super_admin_signed_in? diff --git a/spec/controllers/root_controller_spec.rb b/spec/controllers/root_controller_spec.rb index 80d695886..06981a314 100644 --- a/spec/controllers/root_controller_spec.rb +++ b/spec/controllers/root_controller_spec.rb @@ -9,6 +9,16 @@ describe RootController, type: :controller do it { expect(subject).to redirect_to(dossiers_path) } end + context 'when Expert is connected' do + let(:expert) { create(:expert) } + + before do + sign_in(expert.user) + end + + it { expect(subject).to redirect_to(expert_all_avis_path) } + end + context 'when Instructeur is connected' do let(:instructeur) { create(:instructeur) } let(:procedure) { create(:procedure, :published) } diff --git a/spec/system/experts/expert_spec.rb b/spec/system/experts/expert_spec.rb index 74e187ab5..4a9e91952 100644 --- a/spec/system/experts/expert_spec.rb +++ b/spec/system/experts/expert_spec.rb @@ -37,7 +37,7 @@ describe 'Inviting an expert:' do sign_in_with avis.expert.email, password expect(page).to have_content('Connecté(e).') - expect(page).to have_current_path(dossiers_path) # Ideally we'd want `expert_all_avis_path` instead + expect(page).to have_current_path(expert_all_avis_path) end end @@ -52,9 +52,8 @@ describe 'Inviting an expert:' do expect(page).to have_current_path(new_user_session_path) login_as avis.expert.user, scope: :user sign_in_with(avis.expert.email, 'This is a very complicated password !') - click_on 'Passer en expert' - expect(page).to have_current_path(expert_all_avis_path) - expect(page).to have_text('1 avis à donner') + click_on 'Passer en usager' + expect(page).to have_current_path(dossiers_path) end end