aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-01-13 13:05:51 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-01-13 13:05:51 +0000
commit5f5b053ce879f9a01c04cfe0d6c0600b80979dfe (patch)
tree35e72e91f1d8e11e22bf53c7841ccb58bec96248 /actionmailer/test
parentd3a8d5f93c6eee44a23f26fcb6573e77625f41b0 (diff)
downloadrails-5f5b053ce879f9a01c04cfe0d6c0600b80979dfe.tar.gz
rails-5f5b053ce879f9a01c04cfe0d6c0600b80979dfe.tar.bz2
rails-5f5b053ce879f9a01c04cfe0d6c0600b80979dfe.zip
Fixed that bcc and cc should be settable through @bcc and @cc -- not just @headers["Bcc"] and @headers["Cc"] #453 [Eric Hodel]. Fixed Action Mailer to be "warnings safe" so you can run with ruby -w and not get framework warnings #453 [Eric Hodel]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@399 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/test')
-rwxr-xr-xactionmailer/test/mail_service_test.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index adc5be2fe9..2ad85b605c 100755
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -4,6 +4,7 @@ require 'test/unit'
require 'action_mailer'
class TestMailer < ActionMailer::Base
+
def signed_up(recipient)
@recipients = recipient
@subject = "[Signed up] Welcome #{recipient}"
@@ -19,11 +20,23 @@ class TestMailer < ActionMailer::Base
@sent_on = Time.local(2004, 12, 12)
@body = "Goodbye, Mr. #{recipient}"
end
+
+ def cc_bcc(recipient)
+ @recipients = recipient
+ @subject = "testing bcc/cc"
+ @from = "system@loudthinking.com"
+ @sent_on = Time.local 2004, 12, 12
+ @cc = "nobody@loudthinking.com"
+ @bcc = "root@loudthinking.com"
+ @body = "Nothing to see here."
+ end
+
end
TestMailer.template_root = File.dirname(__FILE__) + "/fixtures"
class ActionMailerTest < Test::Unit::TestCase
+
def setup
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
@@ -68,6 +81,31 @@ class ActionMailerTest < Test::Unit::TestCase
assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
end
+ def test_cc_bcc
+ expected = TMail::Mail.new
+ expected.to = @recipient
+ expected.subject = "testing bcc/cc"
+ expected.body = "Nothing to see here."
+ expected.from = "system@loudthinking.com"
+ expected.cc = "nobody@loudthinking.com"
+ expected.bcc = "root@loudthinking.com"
+ expected.date = Time.local 2004, 12, 12
+
+ created = nil
+ assert_nothing_raised do
+ created = TestMailer.create_cc_bcc @recipient
+ end
+ assert_not_nil created
+ assert_equal expected.encoded, created.encoded
+
+ assert_nothing_raised do
+ TestMailer.deliver_cc_bcc @recipient
+ end
+
+ assert_not_nil ActionMailer::Base.deliveries.first
+ assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
+ end
+
def test_instances_are_nil
assert_nil ActionMailer::Base.new
assert_nil TestMailer.new
@@ -89,4 +127,6 @@ class ActionMailerTest < Test::Unit::TestCase
TestMailer.deliver_signed_up(@recipient)
assert_equal 1, ActionMailer::Base.deliveries.size
end
+
end
+