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

View File

@ -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

View File

@ -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