Verified Commit 7d8e4654 authored by Chrysanthi Lagodimou's avatar Chrysanthi Lagodimou Committed by Kaspar Vollenweider

further dry group offers policy test

parent 842da7b1
Pipeline #13022 passed with stage
in 21 minutes and 34 seconds
......@@ -18,35 +18,28 @@ class GroupOfferPolicyTest < PolicyAssertions::Test
department_manager_without_department = create :department_manager_without_department
manager_group_offer = create :group_offer, creator: department_manager_without_department
other_group_offer = create :group_offer
refute_permit(department_manager_without_department, GroupOffer, 'destroy?',
'supervisor_privileges?')
assert_permit(department_manager_without_department, GroupOffer, 'index?', 'search?', 'new?',
'create?')
assert_permit(department_manager_without_department, manager_group_offer, 'show?',
'edit?', 'update?', 'change_active_state?')
refute_permit(department_manager_without_department, other_group_offer, 'show?', 'edit?',
'update?', 'change_active_state?')
assert_permit(department_manager_without_department, GroupOffer, *@actions[0..3])
assert_permit(department_manager_without_department, manager_group_offer, *@actions[4..7])
refute_permit(department_manager_without_department, other_group_offer, *@actions[4..7])
refute_permit(department_manager_without_department, GroupOffer, *@actions[-2..-1])
end
test 'department_manager_has_limited_access_when_they_have_department' do
department_manager = create :department_manager
department_group_offer = create :group_offer, department: department_manager.department.last
other_group_offer = create :group_offer
refute_permit(department_manager, GroupOffer, 'destroy?', 'supervisor_privileges?')
assert_permit(department_manager, GroupOffer, 'index?', 'search?', 'new?', 'create?')
assert_permit(department_manager, department_group_offer, 'show?', 'edit?', 'update?',
'change_active_state?')
refute_permit(department_manager, other_group_offer, 'show?', 'edit?', 'update?',
'change_active_state?')
assert_permit(department_manager, GroupOffer, *@actions[0..3])
assert_permit(department_manager, department_group_offer, *@actions[4..7])
refute_permit(department_manager, other_group_offer, *@actions[4..7])
refute_permit(department_manager, GroupOffer, *@actions[-2..-1])
end
test 'volunteer_has_limited_access_when_in_group_offer' do
volunteer = create :volunteer_with_user
group_offer_volunteer = create :group_offer, volunteers: [volunteer]
group_offer_other = create :group_offer
refute_permit(volunteer.user, GroupOffer, 'search?', 'new?', 'create?', 'index?', 'edit?',
'update?', 'destroy?', 'supervisor_privileges?', 'change_active_state?')
assert_permit(volunteer.user, group_offer_volunteer, 'show?')
refute_permit(volunteer.user, group_offer_other, 'show?')
refute_permit(volunteer.user, GroupOffer, *@actions[0..3], *@actions[5..-1])
assert_permit(volunteer.user, group_offer_volunteer, *@actions[4])
refute_permit(volunteer.user, group_offer_other, *@actions[4])
end
end
Markdown is supported
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