From 117b795a0cf24df6c77666f0fbce43ed8bc8d6cd Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Wed, 8 Feb 2017 17:57:25 -0600 Subject: [PATCH] reviewer reminders --- app/mailers/reviewer_mailer.rb | 6 ++++++ app/views/reviewer_mailer/reminder.html.inky | 9 +++++++++ app/views/reviewer_mailer/reminder.text.erb | 5 +++++ test/mailers/previews/reviewer_mailer_preview.rb | 6 ++++++ test/mailers/reviewer_mailer_test.rb | 10 ++++++++++ 5 files changed, 36 insertions(+) create mode 100644 app/views/reviewer_mailer/reminder.html.inky create mode 100644 app/views/reviewer_mailer/reminder.text.erb diff --git a/app/mailers/reviewer_mailer.rb b/app/mailers/reviewer_mailer.rb index 9d57d89..7b467b4 100644 --- a/app/mailers/reviewer_mailer.rb +++ b/app/mailers/reviewer_mailer.rb @@ -6,4 +6,10 @@ class ReviewerMailer < ApplicationMailer mail to: recipients, subject: "Skills Assessment Results - #{@candidate.test_hash}" end + + def reminder reminder + @reminder = reminder + + mail to: reminder.email, subject: "Review Reminder" + end end diff --git a/app/views/reviewer_mailer/reminder.html.inky b/app/views/reviewer_mailer/reminder.html.inky new file mode 100644 index 0000000..af7cfc8 --- /dev/null +++ b/app/views/reviewer_mailer/reminder.html.inky @@ -0,0 +1,9 @@ + + + + diff --git a/app/views/reviewer_mailer/reminder.text.erb b/app/views/reviewer_mailer/reminder.text.erb new file mode 100644 index 0000000..ef651e0 --- /dev/null +++ b/app/views/reviewer_mailer/reminder.text.erb @@ -0,0 +1,5 @@ +PERFICIENT/digital SKILLS ASSESSMENT RESULTS + +Hello <%= @reminder.name %>, + +Please review and vote on the results for <%= admin_result_url(@reminder.test_hash) %>. diff --git a/test/mailers/previews/reviewer_mailer_preview.rb b/test/mailers/previews/reviewer_mailer_preview.rb index df8b1cb..bc7f97e 100644 --- a/test/mailers/previews/reviewer_mailer_preview.rb +++ b/test/mailers/previews/reviewer_mailer_preview.rb @@ -4,4 +4,10 @@ class ReviewerMailerPreview < ActionMailer::Preview def candidate_submission ReviewerMailer.candidate_submission Candidate.find_by(test_hash: 'OvP0ZqGKwJ0') # Dawn end + + def reminder + reminders = ReviewerReminder.new + reminder = reminders.reminders.first + ReviewerMailer.reminder reminder + end end diff --git a/test/mailers/reviewer_mailer_test.rb b/test/mailers/reviewer_mailer_test.rb index 35673eb..f02c068 100644 --- a/test/mailers/reviewer_mailer_test.rb +++ b/test/mailers/reviewer_mailer_test.rb @@ -11,4 +11,14 @@ class ReviewerMailerTest < ActionMailer::TestCase assert_equal [ENV["default_mail_from"]], mail.from assert_match candidate.test_hash, mail.body.encoded end + + test "reminder" do + reminders = ReviewerReminder.new + reminder = reminders.reminders.first + mail = ReviewerMailer.reminder reminder + assert_match "Review Reminder", mail.subject + assert_equal [reminder.email], mail.to + assert_equal [ENV["default_mail_from"]], mail.from + assert_match reminder.test_hash, mail.body.encoded + end end