diff --git a/app/mailers/recruiter_mailer.rb b/app/mailers/recruiter_mailer.rb index 8d9e66c..d9dff41 100644 --- a/app/mailers/recruiter_mailer.rb +++ b/app/mailers/recruiter_mailer.rb @@ -1,30 +1,23 @@ # frozen_string_literal: true class RecruiterMailer < ApplicationMailer def candidate_created candidate - @candidate = candidate + @candidate = Candidate.find_by(id: candidate.to_i) mail to: @candidate.recruiter.email, subject: "Skills Assessment Test - #{candidate.name}" end def candidate_submitted candidate - @candidate = candidate + @candidate = Candidate.find_by(id: candidate.to_i) mail to: @candidate.recruiter.email, subject: "Skills Assessment Test - #{candidate.name}" end - def interview_requested candidate - @candidate = candidate + def candidate_reviewed candidate + @candidate = Candidate.find_by(id: candidate.to_i) mail to: @candidate.recruiter.email, - subject: "Skills Assesment - Interview Request for #{candidate.name}" - end - - def interview_declined candidate - @candidate = candidate - - mail to: @candidate.recruiter.email, - subject: "Skills Assesment - Interview Declined for #{candidate.name}" + subject: "Skills Assesment - Review Complete for #{candidate.name}" end end diff --git a/app/views/recruiter_mailer/candidate_reviewed.html.inky b/app/views/recruiter_mailer/candidate_reviewed.html.inky new file mode 100644 index 0000000..1eecc06 --- /dev/null +++ b/app/views/recruiter_mailer/candidate_reviewed.html.inky @@ -0,0 +1,9 @@ + + +

The team has <%= @candidate.review_status %> an interview with <%= @candidate.name %> with the following comments:

+ +

<%= @candidate.review_comments %>

+ +

Thank you

+
+
diff --git a/app/views/recruiter_mailer/candidate_reviewed.text.erb b/app/views/recruiter_mailer/candidate_reviewed.text.erb new file mode 100644 index 0000000..0beabee --- /dev/null +++ b/app/views/recruiter_mailer/candidate_reviewed.text.erb @@ -0,0 +1,7 @@ +PERFICIENT/digital - Skills Assessment Test + +The team has <%= @candidate.review_status %> an interview with <%= @candidate.name %> with the following comments: + +<%= @candidate.review_comments %> + +Thank you. diff --git a/app/views/recruiter_mailer/interview_declined.html.inky b/app/views/recruiter_mailer/interview_declined.html.inky deleted file mode 100644 index 1dd0d42..0000000 --- a/app/views/recruiter_mailer/interview_declined.html.inky +++ /dev/null @@ -1,6 +0,0 @@ - - -

The team has declined an interview with <%= @candidate.name %>.

-

Thank you

-
-
diff --git a/app/views/recruiter_mailer/interview_declined.text.erb b/app/views/recruiter_mailer/interview_declined.text.erb deleted file mode 100644 index 1ef40ae..0000000 --- a/app/views/recruiter_mailer/interview_declined.text.erb +++ /dev/null @@ -1,5 +0,0 @@ -PERFICIENT/digital - Skills Assessment Test - -The team has declined an interview with <%= @candidate.name %>. - -Thank you. diff --git a/app/views/recruiter_mailer/interview_requested.html.inky b/app/views/recruiter_mailer/interview_requested.html.inky deleted file mode 100644 index bbaa0df..0000000 --- a/app/views/recruiter_mailer/interview_requested.html.inky +++ /dev/null @@ -1,6 +0,0 @@ - - -

The team has requested an interview with <%= @candidate.name %>.

-

Thank you

-
-
diff --git a/app/views/recruiter_mailer/interview_requested.text.erb b/app/views/recruiter_mailer/interview_requested.text.erb deleted file mode 100644 index ca5d7f3..0000000 --- a/app/views/recruiter_mailer/interview_requested.text.erb +++ /dev/null @@ -1,5 +0,0 @@ -PERFICIENT/digital - Skills Assessment Test - -The team has requested an interview with <%= @candidate.name %>. - -Thank you. diff --git a/test/mailers/previews/recruiter_mailer_preview.rb b/test/mailers/previews/recruiter_mailer_preview.rb index 257f254..f287a52 100644 --- a/test/mailers/previews/recruiter_mailer_preview.rb +++ b/test/mailers/previews/recruiter_mailer_preview.rb @@ -9,11 +9,7 @@ class RecruiterMailerPreview < ActionMailer::Preview RecruiterMailer.candidate_submitted Candidate.find_by(test_hash: 'OvP0ZqGKwJ0') # Dawn end - def interview_requested - RecruiterMailer.interview_requested Candidate.find_by(test_hash: '6NjnourLE6Y') # Richard - end - - def interview_declined - RecruiterMailer.interview_declined Candidate.find_by(test_hash: 's6oFExZliYYFx') # Stacy + def candidate_reviewed + RecruiterMailer.candidate_reviewed Candidate.find_by(test_hash: 's6oFExZliYYFx') # Stacy end end diff --git a/test/mailers/recruiter_mailer_test.rb b/test/mailers/recruiter_mailer_test.rb index d563fd5..bf1341e 100644 --- a/test/mailers/recruiter_mailer_test.rb +++ b/test/mailers/recruiter_mailer_test.rb @@ -22,21 +22,14 @@ class RecruiterMailerTest < ActionMailer::TestCase assert_match manager.name, mail.body.encoded end - test "interview_requested" do - candidate = candidates :richard - mail = RecruiterMailer.interview_requested 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 - - test "interview_declined" do + test "candidate_reviewed" do candidate = candidates :stacy - mail = RecruiterMailer.interview_declined candidate + mail = RecruiterMailer.candidate_reviewed 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.review_status, mail.body.encoded assert_match candidate.name, mail.body.encoded + assert_match candidate.review_comments, mail.body.encoded end end