aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/mail_service_test.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-06-30 21:21:54 +0000
committerJamis Buck <jamis@37signals.com>2005-06-30 21:21:54 +0000
commit813a8b9d2a17e1f0d7f7dfdcf04a79c94722e283 (patch)
tree17812f8569606ee64aa86330f504dc5850ff82a3 /actionmailer/test/mail_service_test.rb
parent2455f96a6e33ab0d233fd98c7e3313131b4dbda2 (diff)
downloadrails-813a8b9d2a17e1f0d7f7dfdcf04a79c94722e283.tar.gz
rails-813a8b9d2a17e1f0d7f7dfdcf04a79c94722e283.tar.bz2
rails-813a8b9d2a17e1f0d7f7dfdcf04a79c94722e283.zip
Allow template to be explicitly specified #1448 [tuxie@dekadance.se]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1575 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/test/mail_service_test.rb')
-rwxr-xr-xactionmailer/test/mail_service_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index 7efd044796..ce5702db07 100755
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -127,6 +127,16 @@ class TestMailer < ActionMailer::Base
content_type "text/html"
end
+ def custom_template(recipient)
+ recipients recipient
+ subject "[Signed up] Welcome #{recipient}"
+ from "system@loudthinking.com"
+ sent_on Time.local(2004, 12, 12)
+ template "signed_up"
+
+ body["recipient"] = recipient
+ end
+
class <<self
attr_accessor :received_body
end
@@ -179,6 +189,20 @@ class ActionMailerTest < Test::Unit::TestCase
assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
end
+ def test_custom_template
+ expected = new_mail
+ expected.to = @recipient
+ expected.subject = "[Signed up] Welcome #{@recipient}"
+ expected.body = "Hello there, \n\nMr. #{@recipient}"
+ expected.from = "system@loudthinking.com"
+ expected.date = Time.local(2004, 12, 12)
+
+ created = nil
+ assert_nothing_raised { created = TestMailer.create_custom_template(@recipient) }
+ assert_not_nil created
+ assert_equal expected.encoded, created.encoded
+ end
+
def test_cancelled_account
expected = new_mail
expected.to = @recipient