diff options
Diffstat (limited to 'actionmailer/test/mail_layout_test.rb')
-rw-r--r-- | actionmailer/test/mail_layout_test.rb | 62 |
1 files changed, 42 insertions, 20 deletions
diff --git a/actionmailer/test/mail_layout_test.rb b/actionmailer/test/mail_layout_test.rb index f37c26ff69..8df5a2000a 100644 --- a/actionmailer/test/mail_layout_test.rb +++ b/actionmailer/test/mail_layout_test.rb @@ -65,63 +65,85 @@ class LayoutMailerTest < Test::Unit::TestCase def test_should_pickup_default_layout mail = AutoLayoutMailer.create_hello(@recipient) - assert_equal "Hello from layout Inside", mail.body.strip + assert_equal "Hello from layout Inside", mail.body.decoded.strip end def test_should_pickup_multipart_layout mail = AutoLayoutMailer.create_multipart(@recipient) - assert_equal "multipart/alternative", mail.content_type + # CHANGED: content_type returns an object + # assert_equal "multipart/alternative", mail.content_type + assert_equal "multipart/alternative", mail.content_type.content_type assert_equal 2, mail.parts.size - assert_equal 'text/plain', mail.parts.first.content_type - assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body + # CHANGED: content_type returns an object + # assert_equal 'text/plain', mail.parts.first.content_type + assert_equal 'text/plain', mail.parts.first.content_type.content_type + + # CHANGED: body returns an object + # assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body + assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body.decoded - assert_equal 'text/html', mail.parts.last.content_type - assert_equal "Hello from layout text/html multipart", mail.parts.last.body + # CHANGED: content_type returns an object + # assert_equal 'text/html', mail.parts.last.content_type + assert_equal 'text/html', mail.parts.last.content_type.content_type + + # CHANGED: body returns an object + # assert_equal "Hello from layout text/html multipart", mail.parts.last.body + assert_equal "Hello from layout text/html multipart", mail.parts.last.body.decoded end def test_should_pickup_multipartmixed_layout mail = AutoLayoutMailer.create_multipart(@recipient, "multipart/mixed") - assert_equal "multipart/mixed", mail.content_type + # CHANGED: content_type returns an object + # assert_equal "multipart/mixed", mail.content_type + assert_equal "multipart/mixed", mail.content_type.content_type assert_equal 2, mail.parts.size - assert_equal 'text/plain', mail.parts.first.content_type - assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body + # CHANGED: content_type returns an object + # assert_equal 'text/plain', mail.parts.first.content_type + assert_equal 'text/plain', mail.parts.first.content_type.content_type + # CHANGED: body returns an object + # assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body + assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body.decoded - assert_equal 'text/html', mail.parts.last.content_type - assert_equal "Hello from layout text/html multipart", mail.parts.last.body + # CHANGED: content_type returns an object + # assert_equal 'text/html', mail.parts.last.content_type + assert_equal 'text/html', mail.parts.last.content_type.content_type + # CHANGED: body returns an object + # assert_equal "Hello from layout text/html multipart", mail.parts.last.body + assert_equal "Hello from layout text/html multipart", mail.parts.last.body.decoded end def test_should_fix_multipart_layout mail = AutoLayoutMailer.create_multipart(@recipient, "text/plain") - assert_equal "multipart/alternative", mail.content_type + assert_equal "multipart/alternative", mail.content_type.content_type assert_equal 2, mail.parts.size - assert_equal 'text/plain', mail.parts.first.content_type - assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body + assert_equal 'text/plain', mail.parts.first.content_type.content_type + assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body.decoded - assert_equal 'text/html', mail.parts.last.content_type - assert_equal "Hello from layout text/html multipart", mail.parts.last.body + assert_equal 'text/html', mail.parts.last.content_type.content_type + assert_equal "Hello from layout text/html multipart", mail.parts.last.body.decoded end def test_should_pickup_layout_given_to_render mail = AutoLayoutMailer.create_spam(@recipient) - assert_equal "Spammer layout Hello, Earth", mail.body.strip + assert_equal "Spammer layout Hello, Earth", mail.body.decoded.strip end def test_should_respect_layout_false mail = AutoLayoutMailer.create_nolayout(@recipient) - assert_equal "Hello, Earth", mail.body.strip + assert_equal "Hello, Earth", mail.body.decoded.strip end def test_explicit_class_layout mail = ExplicitLayoutMailer.create_signup(@recipient) - assert_equal "Spammer layout We do not spam", mail.body.strip + assert_equal "Spammer layout We do not spam", mail.body.decoded.strip end def test_explicit_layout_exceptions mail = ExplicitLayoutMailer.create_logout(@recipient) - assert_equal "You logged out", mail.body.strip + assert_equal "You logged out", mail.body.decoded.strip end end |