From 4747a9a57ef4af8cd5172c9da5198cd632adce83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 27 Dec 2009 12:18:46 +0100 Subject: Getting rid of some warnings in AM suite. --- actionmailer/test/mail_render_test.rb | 4 +++- actionmailer/test/mail_service_test.rb | 6 +++--- actionmailer/test/mail_test.rb | 24 ++++++++++++++++++++++++ actionmailer/test/test_helper_test.rb | 6 +++--- actionmailer/test/tmail_test.rb | 24 ------------------------ 5 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 actionmailer/test/mail_test.rb delete mode 100644 actionmailer/test/tmail_test.rb (limited to 'actionmailer/test') diff --git a/actionmailer/test/mail_render_test.rb b/actionmailer/test/mail_render_test.rb index 406aa0a116..09ce5e4854 100644 --- a/actionmailer/test/mail_render_test.rb +++ b/actionmailer/test/mail_render_test.rb @@ -53,7 +53,9 @@ class RenderMailer < ActionMailer::Base subject "No Instance Variable" from "tester@example.com" - render :inline => "Look, subject.nil? is <%= @subject.nil? %>!" + silence_warnings do + render :inline => "Look, subject.nil? is <%= @subject.nil? %>!" + end end def initialize_defaults(method_name) diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 87761185f4..d6ed8594d3 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -239,7 +239,7 @@ class TestMailer < ActionMailer::Base from "test@example.com" content_type "multipart/mixed" - part :content_type => "multipart/alternative", :content_disposition => "inline", :headers => { "foo" => "bar" } do |p| + part :content_type => "multipart/alternative", :content_disposition => "inline", "foo" => "bar" do |p| p.part :content_type => "text/plain", :body => "test text\nline #2" p.part :content_type => "text/html", :body => "test HTML
\nline #2" end @@ -264,7 +264,7 @@ class TestMailer < ActionMailer::Base from "test@example.com" content_type "multipart/related" part :content_type => "text/html", :body => 'yo' - attachment :content_type => "image/jpeg", :filename => File.join(File.dirname(__FILE__), "fixtures", "attachments", "test.jpg"), :data => "i am not a real picture", :headers => { 'Content-ID' => '' } + attachment :content_type => "image/jpeg", :filename => File.join(File.dirname(__FILE__), "fixtures", "attachments", "test.jpg"), :data => "i am not a real picture", 'Content-ID' => '' end def unnamed_attachment(recipient) @@ -1251,6 +1251,6 @@ class RespondToTest < Test::Unit::TestCase RespondToMailer.not_a_method end - assert_match /undefined method.*not_a_method/, error.message + assert_match(/undefined method.*not_a_method/, error.message) end end diff --git a/actionmailer/test/mail_test.rb b/actionmailer/test/mail_test.rb new file mode 100644 index 0000000000..ea6f25d157 --- /dev/null +++ b/actionmailer/test/mail_test.rb @@ -0,0 +1,24 @@ +require 'abstract_unit' + +class MailTest < Test::Unit::TestCase + def test_body + m = Mail.new + expected = 'something_with_underscores' + m.content_transfer_encoding = 'quoted-printable' + quoted_body = [expected].pack('*M') + m.body = quoted_body + assert_equal "something_with_underscores=\r\n", m.body.encoded + # CHANGED: body returns object, not string, Changed m.body to m.body.to_s + assert_equal expected, m.body.to_s + end + + def test_nested_attachments_are_recognized_correctly + fixture = File.read("#{File.dirname(__FILE__)}/fixtures/raw_email_with_nested_attachment") + mail = Mail.new(fixture) + assert_equal 2, mail.attachments.length + assert_equal "image/png", mail.attachments.first.mime_type + assert_equal 1902, mail.attachments.first.decoded.length + assert_equal "application/pkcs7-signature", mail.attachments.last.mime_type + end + +end diff --git a/actionmailer/test/test_helper_test.rb b/actionmailer/test/test_helper_test.rb index 8e4254411c..86d22da9bf 100644 --- a/actionmailer/test/test_helper_test.rb +++ b/actionmailer/test/test_helper_test.rb @@ -92,7 +92,7 @@ class TestHelperMailerTest < ActionMailer::TestCase end end - assert_match /2 .* but 1/, error.message + assert_match(/2 .* but 1/, error.message) end def test_assert_emails_too_many_sent @@ -103,7 +103,7 @@ class TestHelperMailerTest < ActionMailer::TestCase end end - assert_match /1 .* but 2/, error.message + assert_match(/1 .* but 2/, error.message) end def test_assert_no_emails_failure @@ -113,7 +113,7 @@ class TestHelperMailerTest < ActionMailer::TestCase end end - assert_match /0 .* but 1/, error.message + assert_match(/0 .* but 1/, error.message) end end diff --git a/actionmailer/test/tmail_test.rb b/actionmailer/test/tmail_test.rb deleted file mode 100644 index bd0190e661..0000000000 --- a/actionmailer/test/tmail_test.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'abstract_unit' - -class TMailMailTest < Test::Unit::TestCase - def test_body - m = Mail.new - expected = 'something_with_underscores' - m.content_transfer_encoding = 'quoted-printable' - quoted_body = [expected].pack('*M') - m.body = quoted_body - assert_equal "something_with_underscores=\r\n", m.body.encoded - # CHANGED: body returns object, not string, Changed m.body to m.body.to_s - assert_equal expected, m.body.to_s - end - - def test_nested_attachments_are_recognized_correctly - fixture = File.read("#{File.dirname(__FILE__)}/fixtures/raw_email_with_nested_attachment") - mail = Mail.new(fixture) - assert_equal 2, mail.attachments.length - assert_equal "image/png", mail.attachments.first.mime_type - assert_equal 1902, mail.attachments.first.decoded.length - assert_equal "application/pkcs7-signature", mail.attachments.last.mime_type - end - -end -- cgit v1.2.3