Redefine user roles with their role in a study group

This commit is contained in:
Sebastian Serth
2022-09-20 16:19:04 +02:00
committed by Sebastian Serth
parent 04ed45ea73
commit 9c9f45ff77
12 changed files with 90 additions and 44 deletions

View File

@ -62,14 +62,10 @@ describe ExecutionEnvironmentPolicy do
expect(policy).to permit(build(:admin))
end
shared_examples 'it does not grant access' do |user|
it "does not grant access to a user with role #{user.role}" do
expect(policy).not_to permit(user)
it 'does not grant access to all other users' do
%i[external_user teacher].each do |factory_name|
expect(policy).not_to permit(build(factory_name))
end
end
%i[teacher external_user].each do |user|
include_examples 'it does not grant access', FactoryBot.build(user) # rubocop:disable RSpec/FactoryBot/SyntaxMethods
end
end
end