-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adoption: Add vaccine reminder mailer (#103)
- Loading branch information
Showing
6 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class MatchMailer < ApplicationMailer | ||
def checklist_reminder(match) | ||
@match = match | ||
|
||
@adopter_account = match.adopter_account | ||
@user = @adopter_account.user | ||
@pet = match.pet | ||
|
||
mail to: @user.email, subject: "#{@pet.name}'s Checklist Reminder" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' /> | ||
</head> | ||
<body> | ||
<h1>Congrats on <%= @pet.name %>'s adoption!</h1> | ||
|
||
<p>Hope everything's going well! This is just a reminder to make sure <%= @pet.name %>'s vaccinations are up to date.</p> | ||
|
||
<p>Have a great day!</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Congrats on <%= @pet.name %>'s adoption! | ||
|
||
Hope everything's going well! This is just a reminder to make sure <%= @pet.name %>'s vaccinations are up to date. | ||
|
||
Have a great day! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require "test_helper" | ||
|
||
class MatchMailerTest < ActionMailer::TestCase | ||
test "checklist reminder" do | ||
email = MatchMailer.checklist_reminder(adoptions(:adoption_one)) | ||
|
||
assert_emails 1 do | ||
email.deliver_now | ||
end | ||
|
||
assert_equal [adoptions(:adoption_one).adopter_account.user.email], email.to | ||
assert_match(/Checklist Reminder/, email.subject) | ||
assert_match(/#{adoptions(:adoption_one).pet.name}/, email.subject) | ||
assert_match(/#{adoptions(:adoption_one).pet.name}/, email.body.encoded) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Preview all emails at http://localhost:3000/rails/mailers/match_mailer | ||
class MatchMailerPreview < ActionMailer::Preview | ||
def checklist_reminder | ||
MatchMailer.checklist_reminder(Adoption.first) | ||
end | ||
end |