reviewer mailers
This commit is contained in:
		
							
								
								
									
										15
									
								
								app/mailers/reviewer_mailer.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								app/mailers/reviewer_mailer.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					class ReviewerMailer < ApplicationMailer
 | 
				
			||||||
 | 
					  def candidate_submission candidate
 | 
				
			||||||
 | 
					    @candidate = candidate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # TODO: candidate.reviewers.map(:email)
 | 
				
			||||||
 | 
					    if Rails.env.production?
 | 
				
			||||||
 | 
					      recipients = ["harish.bhavanichikar@perficient.com", "jacob.schulke@perficient.com",
 | 
				
			||||||
 | 
					                    "jennifer.siegfried@perficient.com", "martin.ridgway@perficient.com"]
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      recipients = ["fed.reviewer@mailinator.com"]
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mail to: recipients, subject: "Skills Assessment Results"
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
							
								
								
									
										18
									
								
								app/views/reviewer_mailer/candidate_submission.html.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								app/views/reviewer_mailer/candidate_submission.html.erb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					<table cellspacing="0" cellpadding="0" border="0" style="width:100%; font-family:sans-serif;">
 | 
				
			||||||
 | 
					  <tr>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <td style="background-color:#cc0c0d; color:#ffffff; padding:15px 20px;">
 | 
				
			||||||
 | 
					      SKILLS ASSESSMENT RESULTS
 | 
				
			||||||
 | 
					    </td>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  </tr>
 | 
				
			||||||
 | 
					  <tr>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <td style="padding:50px;">
 | 
				
			||||||
 | 
					      <h1><%= @candidate.test_hash %></h1>
 | 
				
			||||||
 | 
					      <p>has completed the Skills Assesment Test.</p>
 | 
				
			||||||
 | 
					      <p>You can review the results here: <%= link_to nil, review_test_url(@candidate.test_hash) %></p>
 | 
				
			||||||
 | 
					    </td>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  </tr>
 | 
				
			||||||
 | 
					</table>
 | 
				
			||||||
							
								
								
									
										5
									
								
								app/views/reviewer_mailer/candidate_submission.text.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/views/reviewer_mailer/candidate_submission.text.erb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					SKILLS ASSESSMENT RESULTS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<%= @candidate.test_hash %>
 | 
				
			||||||
 | 
					has completed the Skills Assesment Test.
 | 
				
			||||||
 | 
					You can review the results here: <%= review_test_url(@candidate.test_hash) %>
 | 
				
			||||||
							
								
								
									
										1
									
								
								test/fixtures/users.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								test/fixtures/users.yml
									
									
									
									
										vendored
									
									
								
							@@ -17,4 +17,3 @@ admin:
 | 
				
			|||||||
  email: alan.admin@mailinator.com
 | 
					  email: alan.admin@mailinator.com
 | 
				
			||||||
  password_digest: <%= BCrypt::Password.create("password", cost: 4) %>
 | 
					  password_digest: <%= BCrypt::Password.create("password", cost: 4) %>
 | 
				
			||||||
  role: admin
 | 
					  role: admin
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								test/mailers/previews/reviewer_mailer_preview.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								test/mailers/previews/reviewer_mailer_preview.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					# Preview all emails at http://localhost:3000/rails/mailers/reviewer_mailer
 | 
				
			||||||
 | 
					class ReviewerMailerPreview < ActionMailer::Preview
 | 
				
			||||||
 | 
					  def candidate_submission
 | 
				
			||||||
 | 
					    ReviewerMailer.candidate_submission Candidate.find_by(test_hash: 'OvP0ZqGKwJ0') # Dawn
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
							
								
								
									
										12
									
								
								test/mailers/reviewer_mailer_test.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								test/mailers/reviewer_mailer_test.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					require 'test_helper'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ReviewerMailerTest < ActionMailer::TestCase
 | 
				
			||||||
 | 
					  test "candidate_submission" do
 | 
				
			||||||
 | 
					    candidate = candidates :dawn
 | 
				
			||||||
 | 
					    mail = ReviewerMailer.candidate_submission candidate
 | 
				
			||||||
 | 
					    assert_match "Results", 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
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
		Reference in New Issue
	
	Block a user