Allow teachers to access internal users and manage them in their study groups
This commit is contained in:

committed by
Sebastian Serth

parent
e3018c1847
commit
0e7c38657f
@ -5,7 +5,7 @@ require 'rails_helper'
|
||||
describe InternalUserPolicy do
|
||||
subject(:policy) { described_class }
|
||||
|
||||
%i[create? edit? index? new? show? update?].each do |action|
|
||||
%i[create? edit? new? show? update?].each do |action|
|
||||
permissions(action) do
|
||||
it 'grants access to admins only' do
|
||||
expect(policy).to permit(build(:admin), InternalUser.new)
|
||||
@ -16,6 +16,15 @@ describe InternalUserPolicy do
|
||||
end
|
||||
end
|
||||
|
||||
permissions :index? do
|
||||
it 'grants access to admins and teachers only' do
|
||||
expect(policy).not_to permit(build(:external_user), InternalUser.new)
|
||||
%i[admin teacher].each do |factory_name|
|
||||
expect(policy).to permit(create(factory_name), InternalUser.new)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
permissions :destroy? do
|
||||
context 'with an admin user' do
|
||||
it 'grants access to no one' do
|
||||
|
Reference in New Issue
Block a user