Skip to content

Commit

Permalink
Correction in role for all_actions_allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
anshganatra committed Dec 4, 2024
1 parent 4ca3af3 commit 5ac63c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/concerns/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions spec/controllers/concerns/authorization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

Expand Down

0 comments on commit 5ac63c8

Please sign in to comment.