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
|
||||
def index
|
||||
begin
|
||||
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?
|
||||
if administrateur_signed_in?
|
||||
return redirect_to admin_procedures_path
|
||||
|
||||
elsif gestionnaire_signed_in?
|
||||
|
@ -31,15 +22,10 @@ class RootController < ApplicationController
|
|||
elsif user_signed_in?
|
||||
return redirect_to users_dossiers_path
|
||||
|
||||
elsif administrateur_signed_in?
|
||||
return redirect_to admin_procedures_path
|
||||
|
||||
elsif administration_signed_in?
|
||||
return redirect_to administrations_path
|
||||
end
|
||||
|
||||
@demo_environment_host = "https://tps-dev.apientreprise.fr" unless Rails.env.development?
|
||||
|
||||
render 'landing', :layout => 'new_application'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,6 +45,14 @@ describe RootController, type: :controller do
|
|||
it { expect(subject).to redirect_to(admin_procedures_path) }
|
||||
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
|
||||
render_views
|
||||
|
||||
|
|
Loading…
Reference in a new issue