mailer work
This commit is contained in:
		@@ -1,30 +1,23 @@
 | 
				
			|||||||
# frozen_string_literal: true
 | 
					# frozen_string_literal: true
 | 
				
			||||||
class RecruiterMailer < ApplicationMailer
 | 
					class RecruiterMailer < ApplicationMailer
 | 
				
			||||||
  def candidate_created candidate
 | 
					  def candidate_created candidate
 | 
				
			||||||
    @candidate = candidate
 | 
					    @candidate = Candidate.find_by(id: candidate.to_i)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mail to: @candidate.recruiter.email,
 | 
					    mail to: @candidate.recruiter.email,
 | 
				
			||||||
         subject: "Skills Assessment Test - #{candidate.name}"
 | 
					         subject: "Skills Assessment Test - #{candidate.name}"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def candidate_submitted candidate
 | 
					  def candidate_submitted candidate
 | 
				
			||||||
    @candidate = candidate
 | 
					    @candidate = Candidate.find_by(id: candidate.to_i)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mail to: @candidate.recruiter.email,
 | 
					    mail to: @candidate.recruiter.email,
 | 
				
			||||||
         subject: "Skills Assessment Test - #{candidate.name}"
 | 
					         subject: "Skills Assessment Test - #{candidate.name}"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def interview_requested candidate
 | 
					  def candidate_reviewed candidate
 | 
				
			||||||
    @candidate = candidate
 | 
					    @candidate = Candidate.find_by(id: candidate.to_i)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mail to: @candidate.recruiter.email,
 | 
					    mail to: @candidate.recruiter.email,
 | 
				
			||||||
         subject: "Skills Assesment - Interview Request for #{candidate.name}"
 | 
					         subject: "Skills Assesment - Review Complete for #{candidate.name}"
 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  def interview_declined candidate
 | 
					 | 
				
			||||||
    @candidate = candidate
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mail to: @candidate.recruiter.email,
 | 
					 | 
				
			||||||
         subject: "Skills Assesment - Interview Declined for #{candidate.name}"
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								app/views/recruiter_mailer/candidate_reviewed.html.inky
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/views/recruiter_mailer/candidate_reviewed.html.inky
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					<row>
 | 
				
			||||||
 | 
					  <columns class="email-body">
 | 
				
			||||||
 | 
					    <p>The team has <%= @candidate.review_status %> an interview with <strong><%= @candidate.name %></strong> with the following comments:</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <p><%= @candidate.review_comments %></p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <p>Thank you</p>
 | 
				
			||||||
 | 
					  </columns>
 | 
				
			||||||
 | 
					</row>
 | 
				
			||||||
							
								
								
									
										7
									
								
								app/views/recruiter_mailer/candidate_reviewed.text.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								app/views/recruiter_mailer/candidate_reviewed.text.erb
									
									
									
									
									
										Normal file
									
								
							@@ -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.
 | 
				
			||||||
@@ -1,6 +0,0 @@
 | 
				
			|||||||
<row>
 | 
					 | 
				
			||||||
  <columns class="email-body">
 | 
					 | 
				
			||||||
    <p>The team has declined an interview with <strong><%= @candidate.name %></strong>.</p>
 | 
					 | 
				
			||||||
    <p>Thank you</p>
 | 
					 | 
				
			||||||
  </columns>
 | 
					 | 
				
			||||||
</row>
 | 
					 | 
				
			||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
PERFICIENT/digital - Skills Assessment Test
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The team has declined an interview with <%= @candidate.name %>.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Thank you.
 | 
					 | 
				
			||||||
@@ -1,6 +0,0 @@
 | 
				
			|||||||
<row>
 | 
					 | 
				
			||||||
  <columns class="email-body">
 | 
					 | 
				
			||||||
    <p>The team has requested an interview with <strong><%= @candidate.name %></strong>.</p>
 | 
					 | 
				
			||||||
    <p>Thank you</p>
 | 
					 | 
				
			||||||
  </columns>
 | 
					 | 
				
			||||||
</row>
 | 
					 | 
				
			||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
PERFICIENT/digital - Skills Assessment Test
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The team has requested an interview with <%= @candidate.name %>.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Thank you.
 | 
					 | 
				
			||||||
@@ -9,11 +9,7 @@ class RecruiterMailerPreview < ActionMailer::Preview
 | 
				
			|||||||
    RecruiterMailer.candidate_submitted Candidate.find_by(test_hash: 'OvP0ZqGKwJ0') # Dawn
 | 
					    RecruiterMailer.candidate_submitted Candidate.find_by(test_hash: 'OvP0ZqGKwJ0') # Dawn
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def interview_requested
 | 
					  def candidate_reviewed
 | 
				
			||||||
    RecruiterMailer.interview_requested Candidate.find_by(test_hash: '6NjnourLE6Y') # Richard
 | 
					    RecruiterMailer.candidate_reviewed Candidate.find_by(test_hash: 's6oFExZliYYFx') # Stacy
 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  def interview_declined
 | 
					 | 
				
			||||||
    RecruiterMailer.interview_declined Candidate.find_by(test_hash: 's6oFExZliYYFx') # Stacy
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,21 +22,14 @@ class RecruiterMailerTest < ActionMailer::TestCase
 | 
				
			|||||||
    assert_match manager.name, mail.body.encoded
 | 
					    assert_match manager.name, mail.body.encoded
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  test "interview_requested" do
 | 
					  test "candidate_reviewed" 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
 | 
					 | 
				
			||||||
    candidate = candidates :stacy
 | 
					    candidate = candidates :stacy
 | 
				
			||||||
    mail = RecruiterMailer.interview_declined candidate
 | 
					    mail = RecruiterMailer.candidate_reviewed candidate
 | 
				
			||||||
    assert_match candidate.name, mail.subject
 | 
					    assert_match candidate.name, mail.subject
 | 
				
			||||||
    assert_equal [candidate.recruiter.email], mail.to
 | 
					    assert_equal [candidate.recruiter.email], mail.to
 | 
				
			||||||
    assert_equal [ENV["default_mail_from"]], mail.from
 | 
					    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.name, mail.body.encoded
 | 
				
			||||||
 | 
					    assert_match candidate.review_comments, mail.body.encoded
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user