From 5ac63c86b952d565f7859ee0e51b61370dd4111a Mon Sep 17 00:00:00 2001 From: anshganatra Date: Tue, 3 Dec 2024 21:45:10 -0500 Subject: [PATCH] Correction in role for all_actions_allowed --- app/controllers/concerns/authorization.rb | 2 +- spec/controllers/concerns/authorization_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/concerns/authorization.rb b/app/controllers/concerns/authorization.rb index 1fb9b2e8..bf73682b 100644 --- a/app/controllers/concerns/authorization.rb +++ b/app/controllers/concerns/authorization.rb @@ -13,7 +13,7 @@ def authorize # Check if all actions are allowed def all_actions_allowed? - return true if has_required_role?('Administrator') + return true if has_required_role?('Super Administrator') action_allowed? end diff --git a/spec/controllers/concerns/authorization_spec.rb b/spec/controllers/concerns/authorization_spec.rb index 51944a80..4f083560 100644 --- a/spec/controllers/concerns/authorization_spec.rb +++ b/spec/controllers/concerns/authorization_spec.rb @@ -128,7 +128,7 @@ describe '#all_actions_allowed?' do context 'when the user has the Administrator role' do before do - allow(controller).to receive(:has_required_role?).with('Administrator').and_return(true) + allow(controller).to receive(:has_required_role?).with('Super Administrator').and_return(true) end it 'returns true' do @@ -138,7 +138,7 @@ context 'when the user does not have the Administrator role' do before do - allow(controller).to receive(:has_required_role?).with('Administrator').and_return(false) + allow(controller).to receive(:has_required_role?).with('Super Administrator').and_return(false) allow(controller).to receive(:action_allowed?).and_return(false) end @@ -149,7 +149,7 @@ context 'when action_allowed? returns true' do before do - allow(controller).to receive(:has_required_role?).with('Administrator').and_return(false) + allow(controller).to receive(:has_required_role?).with('Super Administrator').and_return(false) allow(controller).to receive(:action_allowed?).and_return(true) end