aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-10-28 09:22:07 -0200
committerYehuda Katz <wycats@gmail.com>2009-11-01 02:23:49 +0100
commit2aafdc839600240a55cea06c960d0a2a7f63016d (patch)
treeae03f403f64cb0e8938bc7c4e5cd373438e9318a /actionmailer/test
parent81c416b72e44a75ea74ba342cd223a33f3b80caf (diff)
downloadrails-2aafdc839600240a55cea06c960d0a2a7f63016d.tar.gz
rails-2aafdc839600240a55cea06c960d0a2a7f63016d.tar.bz2
rails-2aafdc839600240a55cea06c960d0a2a7f63016d.zip
Use I18n on ActionMailer subjects by default.
Diffstat (limited to 'actionmailer/test')
-rw-r--r--actionmailer/test/mail_service_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index 96c00a4098..f9365ea90c 100644
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -296,6 +296,12 @@ class TestMailer < ActionMailer::Base
body :body => "foo", :bar => "baz"
end
+ def subject_with_i18n(recipient)
+ recipients recipient
+ from "system@loudthinking.com"
+ render :text => "testing"
+ end
+
class << self
attr_accessor :received_body
end
@@ -392,6 +398,15 @@ class ActionMailerTest < Test::Unit::TestCase
assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
end
+ def test_subject_with_i18n
+ assert_nothing_raised { TestMailer.deliver_subject_with_i18n(@recipient) }
+ assert_equal "Subject with i18n", ActionMailer::Base.deliveries.first.subject
+
+ I18n.backend.store_translations('en', :actionmailer => {:subjects => {:test_mailer => {:subject_with_i18n => "New Subject!"}}})
+ assert_nothing_raised { TestMailer.deliver_subject_with_i18n(@recipient) }
+ assert_equal "New Subject!", ActionMailer::Base.deliveries.last.subject
+ end
+
def test_custom_template
expected = new_mail
expected.to = @recipient