policy update
This commit is contained in:
parent
fb5fb40944
commit
854b60bc8c
@ -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?
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user