Commit 11f1c41f authored by Tugce Nur Tas's avatar Tugce Nur Tas Committed by Tuğçe Nur Taş
Browse files

add first policy test for user deletion

parent d2a25d07
......@@ -8,6 +8,16 @@ class UserPolicyTest < ActiveSupport::TestCase
@user_as_department_manager = create :user, :with_profile, role: 'department_manager'
end
test 'Destroy: superadmin can destroy other users' do
assert_permit @user_as_superadmin, @user_as_other_superadmin, 'destroy?'
assert_permit @user_as_superadmin, @user_as_social_worker, 'destroy?'
assert_permit @user_as_superadmin, @user_as_department_manager, 'destroy?'
end
test 'Destroy: superadmin cannot destroy itself' do
refute_permit @user_as_superadmin, @user_as_superadmin, 'destroy?'
end
test 'New: superadmin can create user' do
assert_permit @user_as_superadmin, User, 'new?', 'create?'
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment