dashboard controller

This commit is contained in:
Mark Moser
2016-09-21 17:04:08 -05:00
parent 4a70b795e5
commit 7774a1e3f2
13 changed files with 94 additions and 76 deletions

View File

@ -13,11 +13,11 @@ class UserPolicyTest < PolicyAssertions::Test
assert_equal User.count, scope.count
end
test 'should not allow non_admin to scope' do
test 'non admins can only scope themselves' do
%i(manager reviewer recruiter).each do |role|
assert_raise Pundit::NotAuthorizedError, "Failed to raise auth error for #{role}" do
UserPolicy::Scope.new(users(role), User).resolve
end
scope = UserPolicy::Scope.new(users(role), User).resolve
assert_equal 1, scope.count, "Scope did not have 1 result for #{role}"
assert_equal users(role), scope.first, "Scope did not contain self for #{role}"
end
end