policy update

This commit is contained in:
Mark Moser 2017-03-02 10:27:43 -06:00
parent fb5fb40944
commit 854b60bc8c
2 changed files with 2 additions and 16 deletions

View File

@ -21,13 +21,7 @@ class ReviewerVotePolicy < ApplicationPolicy
user.acts_as_reviewer? user.acts_as_reviewer?
end end
def approve? def interview_request?
return true if user.acts_as_admin?
return false unless record.candidate.reviewers.include? user
user.acts_as_manager?
end
def decline?
return true if user.acts_as_admin? return true if user.acts_as_admin?
return false unless record.candidate.reviewers.include? user return false unless record.candidate.reviewers.include? user
user.acts_as_manager? user.acts_as_manager?

View File

@ -48,15 +48,7 @@ class ReviewerVotePolicyTest < PolicyAssertions::Test
refute_permit users(:manager), reviewer_votes(:gustov) refute_permit users(:manager), reviewer_votes(:gustov)
end end
def approve def interview_request
assert_permit users(:manager), reviewer_votes(:manager_richard)
assert_permit users(:admin), reviewer_votes(:manager_henry)
refute_permit users(:recruiter), reviewer_votes(:manager_henry)
refute_permit users(:reviewer), reviewer_votes(:reviewer_richard)
end
def decline
assert_permit users(:manager), reviewer_votes(:manager_richard) assert_permit users(:manager), reviewer_votes(:manager_richard)
assert_permit users(:admin), reviewer_votes(:manager_henry) assert_permit users(:admin), reviewer_votes(:manager_henry)