Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tammer Saleh
committed
Oct 20, 2009
1 parent
376163b
commit 14b032d
Showing
8 changed files
with
65 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,31 @@ | ||
class Mailer < ActionMailer::Base | ||
def create_confirmation(user) | ||
@subject = I18n.t 'actionmailer.create_confirmation', :default => 'Create confirmation' | ||
@from = "none@example.com" | ||
@recipients = user.email | ||
@body[:user] = user | ||
end | ||
|
||
def update_confirmation(user) | ||
@subject = I18n.t 'actionmailer.update_confirmation', :default => 'Update e-mail confirmation' | ||
@from = "none@example.com" | ||
@recipients = user.email | ||
@body[:user] = user | ||
end | ||
|
||
def reset_password(user) | ||
@subject = I18n.t 'actionmailer.reset_password', :default => 'Reset password' | ||
@from = "none@example.com" | ||
@recipients = user.email | ||
@body[:user] = user | ||
end | ||
|
||
def resend_confirmation(user) | ||
@subject = I18n.t 'actionmailer.resend_confirmation', :default => 'Confirmation code' | ||
@from = "none@example.com" | ||
@recipients = user.email | ||
@body[:user] = user | ||
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 @@ | ||
Welcome! Your confirmation code is <%= @user.perishable_token %>. |
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 @@ | ||
Your confirmation code is <%= @user.perishable_token %>. |
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 @@ | ||
Your reset password code is <%= @user.perishable_token %>. |
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 @@ | ||
Your new confirmation code is <%= @user.perishable_token %>. |
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,20 @@ | ||
require 'test_helper' | ||
|
||
class MailerTest < ActionMailer::TestCase | ||
%w(create_confirmation update_confirmation reset_password resend_confirmation).each do |email_type| | ||
context "A #{email_type.humanize} email" do | ||
setup do | ||
@user = Factory(:user, :email => 'recipient@email.com', :perishable_token => '0123456789') | ||
@email = Mailer.send("create_#{email_type}", @user) | ||
end | ||
|
||
should "be delivered to the user's email address" do | ||
assert_equal [@user.email], @email.to | ||
end | ||
|
||
should "contain the perishable token" do | ||
assert_match(/#{@user.perishable_token}/, @email.body) | ||
end | ||
end | ||
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