Pulls manager name for recruiter email - completes #92

This commit is contained in:
Mark Moser 2017-02-27 09:11:07 -06:00
parent eb6a98443c
commit 7f8e74c6b3
4 changed files with 7 additions and 5 deletions

View File

@ -38,7 +38,7 @@ class Candidate < ApplicationRecord
def manager def manager
manager_votes = votes.joins(:user).where("users.role = 'manager'") manager_votes = votes.joins(:user).where("users.role = 'manager'")
return nil if manager_votes.empty? return User.new(name: "No Manager") if manager_votes.empty?
manager_votes.first.user manager_votes.first.user
end end

View File

@ -1,6 +1,6 @@
<row> <row>
<columns class="email-body"> <columns class="email-body">
<p><strong><%= @candidate.name %></strong> has completed the Skills Assessment Test.</p> <p><strong><%= @candidate.name %></strong> has completed the Skills Assessment Test.</p>
<p><strong>Martin Ridgway</strong> will let you know if we would like to interview this candidate.</p> <p><strong><%= @candidate.manager.name %></strong> will let you know if we would like to interview this candidate.</p>
</columns> </columns>
</row> </row>

View File

@ -1,4 +1,4 @@
PERFICIENT/digital - Skills Assessment Test PERFICIENT/digital - Skills Assessment Test
<%= @candidate.name %> has completed the Skills Assessment Test. <%= @candidate.name %> has completed the Skills Assessment Test.
Martin Ridgway will let you know if we would like to interview this candidate. <%= @candidate.manager.name %> will let you know if we would like to interview this candidate.

View File

@ -12,12 +12,14 @@ class RecruiterMailerTest < ActionMailer::TestCase
end end
test "candidate_submitted" do test "candidate_submitted" do
candidate = candidates :dawn candidate = candidates :elsie
manager = users :manager
mail = RecruiterMailer.candidate_submitted candidate mail = RecruiterMailer.candidate_submitted candidate
assert_match candidate.name, mail.subject assert_match candidate.name, mail.subject
assert_equal [candidate.recruiter.email], mail.to assert_equal [candidate.recruiter.email], mail.to
assert_equal [ENV["default_mail_from"]], mail.from assert_equal [ENV["default_mail_from"]], mail.from
assert_match candidate.name, mail.body.encoded assert_match candidate.name, mail.body.encoded
assert_match manager.name, mail.body.encoded
end end
test "interview_requested" do test "interview_requested" do