Merge pull request #382 from sgmap/fix_bug_on_admin_sign_out
Fix bug on admin sign out
This commit is contained in:
commit
1cf4326f1d
2 changed files with 9 additions and 15 deletions
|
@ -1,15 +1,6 @@
|
||||||
class RootController < ApplicationController
|
class RootController < ApplicationController
|
||||||
def index
|
def index
|
||||||
begin
|
if administrateur_signed_in?
|
||||||
route = Rails.application.routes.recognize_path(request.referrer)
|
|
||||||
rescue ActionController::RoutingError
|
|
||||||
route = Rails.application.routes.recognize_path(new_user_session_path)
|
|
||||||
end
|
|
||||||
|
|
||||||
if user_signed_in? && !route[:controller].match('users').nil?
|
|
||||||
return redirect_to users_dossiers_path
|
|
||||||
|
|
||||||
elsif administrateur_signed_in? && !route[:controller].match('admin').nil?
|
|
||||||
return redirect_to admin_procedures_path
|
return redirect_to admin_procedures_path
|
||||||
|
|
||||||
elsif gestionnaire_signed_in?
|
elsif gestionnaire_signed_in?
|
||||||
|
@ -31,15 +22,10 @@ class RootController < ApplicationController
|
||||||
elsif user_signed_in?
|
elsif user_signed_in?
|
||||||
return redirect_to users_dossiers_path
|
return redirect_to users_dossiers_path
|
||||||
|
|
||||||
elsif administrateur_signed_in?
|
|
||||||
return redirect_to admin_procedures_path
|
|
||||||
|
|
||||||
elsif administration_signed_in?
|
elsif administration_signed_in?
|
||||||
return redirect_to administrations_path
|
return redirect_to administrations_path
|
||||||
end
|
end
|
||||||
|
|
||||||
@demo_environment_host = "https://tps-dev.apientreprise.fr" unless Rails.env.development?
|
|
||||||
|
|
||||||
render 'landing', :layout => 'new_application'
|
render 'landing', :layout => 'new_application'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,6 +45,14 @@ describe RootController, type: :controller do
|
||||||
it { expect(subject).to redirect_to(admin_procedures_path) }
|
it { expect(subject).to redirect_to(admin_procedures_path) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when Administration is connected' do
|
||||||
|
before do
|
||||||
|
sign_in create(:administration)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(subject).to redirect_to(administrations_path) }
|
||||||
|
end
|
||||||
|
|
||||||
context 'when nobody is connected' do
|
context 'when nobody is connected' do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue