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