From 4136db4aabe51868b6b94d7d0d287af99deccc71 Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Tue, 2 Aug 2016 10:35:33 -0500 Subject: [PATCH] recruiter mailer --- app/mailers/recruiter_mailer.rb | 13 ++++++++++ .../candidate_created.html.erb | 24 +++++++++++++++++++ .../candidate_created.text.erb | 10 ++++++++ .../candidate_submitted.html.erb | 17 +++++++++++++ .../candidate_submitted.text.erb | 4 ++++ .../previews/recruiter_mailer_preview.rb | 10 ++++++++ test/mailers/recruiter_mailer_test.rb | 21 ++++++++++++++++ 7 files changed, 99 insertions(+) create mode 100644 app/mailers/recruiter_mailer.rb create mode 100644 app/views/recruiter_mailer/candidate_created.html.erb create mode 100644 app/views/recruiter_mailer/candidate_created.text.erb create mode 100644 app/views/recruiter_mailer/candidate_submitted.html.erb create mode 100644 app/views/recruiter_mailer/candidate_submitted.text.erb create mode 100644 test/mailers/previews/recruiter_mailer_preview.rb create mode 100644 test/mailers/recruiter_mailer_test.rb diff --git a/app/mailers/recruiter_mailer.rb b/app/mailers/recruiter_mailer.rb new file mode 100644 index 0000000..06fb44b --- /dev/null +++ b/app/mailers/recruiter_mailer.rb @@ -0,0 +1,13 @@ +class RecruiterMailer < ApplicationMailer + def candidate_created candidate + @candidate = candidate + + mail to: @candidate.recruiter.email, subject: "Skills Assessment Test - #{candidate.name}" + end + + def candidate_submitted candidate + @candidate = candidate + + mail to: @candidate.recruiter.email, subject: "Skills Assessment Test - #{candidate.name}" + end +end diff --git a/app/views/recruiter_mailer/candidate_created.html.erb b/app/views/recruiter_mailer/candidate_created.html.erb new file mode 100644 index 0000000..2138311 --- /dev/null +++ b/app/views/recruiter_mailer/candidate_created.html.erb @@ -0,0 +1,24 @@ + + + + + + + + + + + +
+ PERFICIENT DIGITAL - Skills Assessment Test +
+

The following candidate has been invited to take the Skills Assessment Test:

+

+ Candidate Name: <%= @candidate.name %>
+ Candidate Email: <%= @candidate.email %>
+ Candidate ID: <%= @candidate.test_hash %>
+ Years of Experience: <%= @candidate.experience %> Years
+

+ +

You will be notified when the candidate has finished taking the test.

+
diff --git a/app/views/recruiter_mailer/candidate_created.text.erb b/app/views/recruiter_mailer/candidate_created.text.erb new file mode 100644 index 0000000..e8d2529 --- /dev/null +++ b/app/views/recruiter_mailer/candidate_created.text.erb @@ -0,0 +1,10 @@ +PERFICIENT DIGITAL - Skills Assessment Test + +The following candidate has been invited to take the Skills Assessment Test: + +Candidate Name: <%= @candidate.name %> +Candidate Email: <%= @candidate.email %> +Candidate ID: <%= @candidate.test_hash %> +Years of Experience: <%= @candidate.experience %> Years + +You will be notified when the candidate has finished taking the test. diff --git a/app/views/recruiter_mailer/candidate_submitted.html.erb b/app/views/recruiter_mailer/candidate_submitted.html.erb new file mode 100644 index 0000000..23070ea --- /dev/null +++ b/app/views/recruiter_mailer/candidate_submitted.html.erb @@ -0,0 +1,17 @@ + + + + + + + + + + + +
+ PERFICIENT DIGITAL - 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.

+
diff --git a/app/views/recruiter_mailer/candidate_submitted.text.erb b/app/views/recruiter_mailer/candidate_submitted.text.erb new file mode 100644 index 0000000..d27ef77 --- /dev/null +++ b/app/views/recruiter_mailer/candidate_submitted.text.erb @@ -0,0 +1,4 @@ +PERFICIENT DIGITAL - 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. diff --git a/test/mailers/previews/recruiter_mailer_preview.rb b/test/mailers/previews/recruiter_mailer_preview.rb new file mode 100644 index 0000000..b739fb8 --- /dev/null +++ b/test/mailers/previews/recruiter_mailer_preview.rb @@ -0,0 +1,10 @@ +# Preview all emails at http://localhost:3000/rails/mailers/recruiter_mailer +class RecruiterMailerPreview < ActionMailer::Preview + def candidate_created + RecruiterMailer.candidate_created Candidate.find_by(test_hash: 'R67PmfDHGiw') # Martha + end + + def candidate_submitted + RecruiterMailer.candidate_submitted Candidate.find_by(test_hash: 'OvP0ZqGKwJ0') # Dawn + end +end diff --git a/test/mailers/recruiter_mailer_test.rb b/test/mailers/recruiter_mailer_test.rb new file mode 100644 index 0000000..e6fabe4 --- /dev/null +++ b/test/mailers/recruiter_mailer_test.rb @@ -0,0 +1,21 @@ +require 'test_helper' + +class RecruiterMailerTest < ActionMailer::TestCase + test "candidate_created" do + candidate = candidates :martha + mail = RecruiterMailer.candidate_created candidate + assert_match candidate.name, mail.subject + assert_equal [candidate.recruiter.email], mail.to + assert_equal [ENV["default_mail_from"]], mail.from + assert_match candidate.test_hash, mail.body.encoded + end + + test "candidate_submitted" do + candidate = candidates :dawn + mail = RecruiterMailer.candidate_submitted candidate + assert_match candidate.name, mail.subject + assert_equal [candidate.recruiter.email], mail.to + assert_equal [ENV["default_mail_from"]], mail.from + assert_match candidate.name, mail.body.encoded + end +end