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

adapt user policy test

parent 370fe477
......@@ -8,14 +8,21 @@ 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?'
test 'Destroy: superadmin can delete other user' do
assert_permit @user_as_superadmin, @user_as_social_worker, 'destroy?'
assert_permit @user_as_superadmin, @user_as_department_manager, 'destroy?'
assert_permit @user_as_other_superadmin, @user_as_social_worker, 'destroy?'
assert_permit @user_as_other_superadmin, @user_as_department_manager, 'destroy?'
end
test 'Destroy: superadmin cannot destroy itself' do
test 'Destroy: superadmin cannot delete other superadmin' do
refute_permit @user_as_superadmin, @user_as_other_superadmin, 'destroy?'
refute_permit @user_as_other_superadmin, @user_as_superadmin, 'destroy?'
end
test 'Destroy: superadmin cannot delete itself' do
refute_permit @user_as_superadmin, @user_as_superadmin, 'destroy?'
refute_permit @user_as_other_superadmin, @user_as_other_superadmin, 'destroy?'
end
test 'New: superadmin can create user' do
......
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