amelioration(expert.sign-in): ETQ expert, je suis redirigé vers la page listant les avis a donner ap connexion
This commit is contained in:
parent
b56d5199e2
commit
4380fecd73
3 changed files with 15 additions and 4 deletions
|
@ -6,6 +6,8 @@ class RootController < ApplicationController
|
||||||
return redirect_to admin_procedures_path
|
return redirect_to admin_procedures_path
|
||||||
elsif instructeur_signed_in?
|
elsif instructeur_signed_in?
|
||||||
return redirect_to instructeur_procedures_path
|
return redirect_to instructeur_procedures_path
|
||||||
|
elsif expert_signed_in?
|
||||||
|
return redirect_to expert_all_avis_path
|
||||||
elsif user_signed_in?
|
elsif user_signed_in?
|
||||||
return redirect_to dossiers_path
|
return redirect_to dossiers_path
|
||||||
elsif super_admin_signed_in?
|
elsif super_admin_signed_in?
|
||||||
|
|
|
@ -9,6 +9,16 @@ describe RootController, type: :controller do
|
||||||
it { expect(subject).to redirect_to(dossiers_path) }
|
it { expect(subject).to redirect_to(dossiers_path) }
|
||||||
end
|
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
|
context 'when Instructeur is connected' do
|
||||||
let(:instructeur) { create(:instructeur) }
|
let(:instructeur) { create(:instructeur) }
|
||||||
let(:procedure) { create(:procedure, :published) }
|
let(:procedure) { create(:procedure, :published) }
|
||||||
|
|
|
@ -37,7 +37,7 @@ describe 'Inviting an expert:' do
|
||||||
sign_in_with avis.expert.email, password
|
sign_in_with avis.expert.email, password
|
||||||
|
|
||||||
expect(page).to have_content('Connecté(e).')
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -52,9 +52,8 @@ describe 'Inviting an expert:' do
|
||||||
expect(page).to have_current_path(new_user_session_path)
|
expect(page).to have_current_path(new_user_session_path)
|
||||||
login_as avis.expert.user, scope: :user
|
login_as avis.expert.user, scope: :user
|
||||||
sign_in_with(avis.expert.email, 'This is a very complicated password !')
|
sign_in_with(avis.expert.email, 'This is a very complicated password !')
|
||||||
click_on 'Passer en expert'
|
click_on 'Passer en usager'
|
||||||
expect(page).to have_current_path(expert_all_avis_path)
|
expect(page).to have_current_path(dossiers_path)
|
||||||
expect(page).to have_text('1 avis à donner')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue