recruiter notification on interview status change re: #85

This commit is contained in:
Mark Moser
2016-11-30 18:55:27 -06:00
parent bcb840c986
commit fa27aac083
9 changed files with 103 additions and 18 deletions

View File

@ -3,6 +3,8 @@ require 'test_helper'
module Admin
class VoteControllerTest < ActionDispatch::IntegrationTest
include ActiveJob::TestHelper
test "reviewer can up vote henry" do
auth_user users(:reviewer)
henry = candidates(:henry)
@ -42,18 +44,33 @@ module Admin
get admin_approve_vote_url(henry.test_hash)
assert_equal 1, henry.votes.approved.count
assert_equal 'approved', Candidate.find(henry.to_i).review_status
assert_equal 'approved', Candidate.find(henry.to_i).review_status, xhr: true
assert_response :success
data = JSON.parse(response.body)
assert_match 'requested', data["message"]
end
test "manager can decline henry" do
auth_user users(:manager)
henry = candidates(:henry)
get admin_decline_vote_url(henry.test_hash)
get admin_decline_vote_url(henry.test_hash), xhr: true
assert_equal 1, henry.votes.rejected.count
assert_equal 'declined', Candidate.find(henry.to_i).review_status
assert_response :success
data = JSON.parse(response.body)
assert_match 'declined', data["message"]
end
test "should queue up a notification when manager approves henry" do
auth_user users(:manager)
henry = candidates(:henry)
assert_enqueued_jobs 1 do
get admin_approve_vote_url(henry.test_hash), xhr: true
end
assert_response :success
data = JSON.parse(response.body)
assert_match 'requested', data["message"]
end
end
end