diff options
author | José Valim and Mikel Lindsaar <pair@programming.com> | 2010-01-26 01:43:41 +0100 |
---|---|---|
committer | José Valim and Mikel Lindsaar <pair@programming.com> | 2010-01-26 01:43:41 +0100 |
commit | 6589976533b7a6850390ed5d6526ca719e56c5ca (patch) | |
tree | c4b3bfb8bb961e70d963a4b97bcf19ef1f82411e /actionmailer/test/base_test.rb | |
parent | 1b3cb54ebae685d4db9eefc99ce68b36d5641751 (diff) | |
download | rails-6589976533b7a6850390ed5d6526ca719e56c5ca.tar.gz rails-6589976533b7a6850390ed5d6526ca719e56c5ca.tar.bz2 rails-6589976533b7a6850390ed5d6526ca719e56c5ca.zip |
Remove old files, add some information to docs and improve test suite.
Diffstat (limited to 'actionmailer/test/base_test.rb')
-rw-r--r-- | actionmailer/test/base_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index 0705f22df8..856b5b2d3c 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -56,6 +56,13 @@ class BaseTest < ActiveSupport::TestCase format.any(:text, :html){ render :text => "Format with any!" } end end + + def custom_block(include_html=false) + mail(DEFAULT_HEADERS) do |format| + format.text(:content_transfer_encoding => "base64"){ render "welcome" } + format.html{ render "welcome" } if include_html + end + end end test "method call to mail does not raise error" do @@ -337,6 +344,23 @@ class BaseTest < ActiveSupport::TestCase assert_equal("Format with any!", email.parts[1].body.encoded) end + test "explicit multipart with options" do + email = BaseMailer.custom_block(true).deliver + assert_equal(2, email.parts.size) + assert_equal("multipart/alternate", email.mime_type) + assert_equal("text/plain", email.parts[0].mime_type) + assert_equal("base64", email.parts[0].content_transfer_encoding) + assert_equal("text/html", email.parts[1].mime_type) + assert_equal("7bit", email.parts[1].content_transfer_encoding) + end + + test "explicit multipart with one part is rendered as body" do + email = BaseMailer.custom_block.deliver + assert_equal(0, email.parts.size) + assert_equal("text/plain", email.mime_type) + assert_equal("base64", email.content_transfer_encoding) + end + # Class level API with method missing test "should respond to action methods" do assert BaseMailer.respond_to?(:welcome) |