diff --git a/app/mailers/candidate_mailer.rb b/app/mailers/candidate_mailer.rb
new file mode 100644
index 0000000..ac3486d
--- /dev/null
+++ b/app/mailers/candidate_mailer.rb
@@ -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
diff --git a/app/views/candidate_mailer/reminder.html.erb b/app/views/candidate_mailer/reminder.html.erb
new file mode 100644
index 0000000..74faed6
--- /dev/null
+++ b/app/views/candidate_mailer/reminder.html.erb
@@ -0,0 +1,27 @@
+
+
+
+
+ PERFICIENT DIGITAL - Skills Assessment Test
+ |
+
+
+
+
+
+ Dear <%= @candidate.name %>,
+
+ 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 %>
+
+
+ You can return to the test here:
+ <%= link_to nil, root_url %>
+
+ Your test id is: <%= @candidate.test_hash %>
+
+ |
+
+
+
diff --git a/app/views/candidate_mailer/reminder.text.erb b/app/views/candidate_mailer/reminder.text.erb
new file mode 100644
index 0000000..f9895f3
--- /dev/null
+++ b/app/views/candidate_mailer/reminder.text.erb
@@ -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 %>
diff --git a/app/views/candidate_mailer/submitted.html.erb b/app/views/candidate_mailer/submitted.html.erb
new file mode 100644
index 0000000..32a4af8
--- /dev/null
+++ b/app/views/candidate_mailer/submitted.html.erb
@@ -0,0 +1,17 @@
+
+
+
+
+ PERFICIENT DIGITAL - Skills Assessment Test
+ |
+
+
+
+
+
+ Dear <%= @candidate.name %>,
+ Thank you for taking the Skills Assessment Test. Your recruiter will be in touch.
+ |
+
+
+
diff --git a/app/views/candidate_mailer/submitted.text.erb b/app/views/candidate_mailer/submitted.text.erb
new file mode 100644
index 0000000..dcbc844
--- /dev/null
+++ b/app/views/candidate_mailer/submitted.text.erb
@@ -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.
diff --git a/app/views/candidate_mailer/welcome.html.erb b/app/views/candidate_mailer/welcome.html.erb
new file mode 100644
index 0000000..3336217
--- /dev/null
+++ b/app/views/candidate_mailer/welcome.html.erb
@@ -0,0 +1,27 @@
+
+
+
+
+ PERFICIENT DIGITAL - Skills Assessment Test
+ |
+
+
+
+
+
+ Your Candidate ID is <%= @candidate.test_hash %>
+ |
+
+
+
+
+
+
+ Please visit <%= link_to nil, 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!
+ |
+
+
+
diff --git a/app/views/candidate_mailer/welcome.text.erb b/app/views/candidate_mailer/welcome.text.erb
new file mode 100644
index 0000000..6194b9a
--- /dev/null
+++ b/app/views/candidate_mailer/welcome.text.erb
@@ -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!
diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb
index cbd34d2..ab4308c 100644
--- a/app/views/layouts/mailer.html.erb
+++ b/app/views/layouts/mailer.html.erb
@@ -3,7 +3,7 @@
diff --git a/test/mailers/candidate_mailer_test.rb b/test/mailers/candidate_mailer_test.rb
new file mode 100644
index 0000000..1b41c27
--- /dev/null
+++ b/test/mailers/candidate_mailer_test.rb
@@ -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
diff --git a/test/mailers/previews/candidate_mailer_preview.rb b/test/mailers/previews/candidate_mailer_preview.rb
new file mode 100644
index 0000000..08ee6c9
--- /dev/null
+++ b/test/mailers/previews/candidate_mailer_preview.rb
@@ -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