candidate mailer

This commit is contained in:
Mark Moser 2016-08-02 10:08:16 -05:00
parent f7ec6ee84f
commit 78238e6d72
10 changed files with 161 additions and 1 deletions

@ -0,0 +1,19 @@
class CandidateMailer < ApplicationMailer
def welcome candidate
@candidate = candidate
mail to: @candidate.email, subject: "Perficient Digital - Skills Assessment Test"
end
def reminder candidate
@candidate = candidate
mail to: @candidate.email, subject: "Perficient Digital - Skills Assessment Test"
end
def submitted candidate
@candidate = candidate
mail to: @candidate.email, subject: "Perficient Digital - Skills Assessment Test"
end
end

@ -0,0 +1,27 @@
<table cellspacing="0" cellpadding="0" border="0" style="width:100%; font-family:sans-serif;">
<tr>
<td style="background-color:#cc0c0d; color:#ffffff; padding:15px 20px;">
PERFICIENT DIGITAL - Skills Assessment Test
</td>
</tr>
<tr>
<td style="padding:50px;">
<p>Dear <strong><%= @candidate.name %></strong>,</p>
<p>
Thank you for taking the Skills Assessment Test. However, it looks like you have not submitted it
yet. If you are having troubles, please reach out to your recruiter:
<%= mail_to @candidate.recruiter.email %>
</p>
<p>
You can return to the test here:
<%= link_to nil, root_url %>
<br>
Your test id is: <%= @candidate.test_hash %>
</p>
</td>
</tr>
</table>

@ -0,0 +1,10 @@
PERFICIENT DIGITAL - Skills Assessment Test
Thank you for taking the Skills Assessment Test. However, it looks like you have not submitted it
yet. If you are having troubles, please reach out to your recruiter:
<%= @candidate.recruiter.email %>
You can return to the test here:
<%= root_url %>
Your test id is: <%= @candidate.test_hash %>

@ -0,0 +1,17 @@
<table cellspacing="0" cellpadding="0" border="0" style="width:100%; font-family:sans-serif;">
<tr>
<td style="background-color:#cc0c0d; color:#ffffff; padding:15px 20px;">
PERFICIENT DIGITAL - Skills Assessment Test
</td>
</tr>
<tr>
<td style="padding:50px;">
<p>Dear <strong><%= @candidate.name %></strong>,</p>
<p>Thank you for taking the Skills Assessment Test. Your recruiter will be in touch.</p>
</td>
</tr>
</table>

@ -0,0 +1,5 @@
PERFICIENT DIGITAL - Skills Assessment Test
Dear <%= @candidate.name %>,
Thank you for taking the Skills Assessment Test. Your recruiter will be in touch.

@ -0,0 +1,27 @@
<table cellspacing="0" cellpadding="0" border="0" style="width:100%; font-family:sans-serif;">
<tr>
<td style="background-color:#cc0c0d; color:#ffffff; padding:15px 20px;">
PERFICIENT DIGITAL - Skills Assessment Test
</td>
</tr>
<tr>
<td style="text-align:center; padding:50px;">
<h1>Your Candidate ID is <i><%= @candidate.test_hash %></i></h1>
</td>
</tr>
<tr>
<td style="padding:15px 20px; background-color:#cdcdcd; text-align:center;">
<h4>
Please visit <%= link_to nil, root_url %>
and enter the above Candidate ID to being your test.
</h4>
<h5>We will reach back to you once we have evaluated your answers. Good luck!</h5>
</td>
</tr>
</table>

@ -0,0 +1,10 @@
PERFICIENT DIGITAL - Skills Assessment Test
Your Candidate ID is <%= @candidate.test_hash %>
Please visit <%= root_url %>
and enter the above Candidate ID to being your test.
We will reach back to you once we have evaluated your answers.
Good luck!

@ -3,7 +3,7 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style> <style>
/* Email styles need to be inline */ <% # Email styles need to be inline %>
</style> </style>
</head> </head>

@ -0,0 +1,31 @@
require 'test_helper'
class CandidateMailerTest < ActionMailer::TestCase
test "welcome" do
candidate = candidates(:martha)
mail = CandidateMailer.welcome candidate
assert_match(/skills assessment test/i, mail.subject)
assert_equal [candidate.email], mail.to
assert_equal [ENV["default_mail_from"]], mail.from
assert_match candidate.test_hash, mail.body.encoded
end
test "reminder" do
candidate = candidates(:roy)
mail = CandidateMailer.reminder candidate
assert_match(/skills assessment test/i, mail.subject)
assert_equal [candidate.email], mail.to
assert_equal [ENV["default_mail_from"]], mail.from
assert_match candidate.test_hash, mail.body.encoded
assert_match candidate.recruiter.email, mail.body.encoded
end
test "submitted" do
candidate = candidates(:dawn)
mail = CandidateMailer.submitted candidate
assert_match(/skills assessment test/i, mail.subject)
assert_equal [candidate.email], mail.to
assert_equal [ENV["default_mail_from"]], mail.from
assert_match candidate.name, mail.body.encoded
end
end

@ -0,0 +1,14 @@
# Preview all emails at http://localhost:3000/rails/mailers/candidate_mailer
class CandidateMailerPreview < ActionMailer::Preview
def welcome
CandidateMailer.welcome Candidate.find_by(test_hash: 'R67PmfDHGiw') # Martha
end
def reminder
CandidateMailer.reminder Candidate.find_by(test_hash: 'NmEjDkOEKY4') # Roy
end
def submitted
CandidateMailer.submitted Candidate.find_by(test_hash: 'OvP0ZqGKwJ0') # Dawn
end
end