diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-10-26 02:21:21 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-10-26 02:21:21 +0000 |
commit | 2cc0cac3efce92bf9d0e8636f2889c37ca9f57ab (patch) | |
tree | 3ad613f6c73cd9fef243f7586dfcf3b6f329105b /actionmailer/test/test_helper_test.rb | |
parent | 2bfd6772a4f3f9e0ff395cfd415dafbc1c9dec80 (diff) | |
download | rails-2cc0cac3efce92bf9d0e8636f2889c37ca9f57ab.tar.gz rails-2cc0cac3efce92bf9d0e8636f2889c37ca9f57ab.tar.bz2 rails-2cc0cac3efce92bf9d0e8636f2889c37ca9f57ab.zip |
Introduce TestCase subclasses for testing rails applications allowing tests to be DRY'd up a bit and to provide a path toward tidying up our monkeypatching of test/unit.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8022 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/test/test_helper_test.rb')
-rw-r--r-- | actionmailer/test/test_helper_test.rb | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/actionmailer/test/test_helper_test.rb b/actionmailer/test/test_helper_test.rb index 08f92865ca..eb17e3e803 100644 --- a/actionmailer/test/test_helper_test.rb +++ b/actionmailer/test/test_helper_test.rb @@ -8,13 +8,38 @@ class TestHelperMailer < ActionMailer::Base end end -class TestHelperTest < Test::Unit::TestCase - def setup - ActionMailer::Base.delivery_method = :test - ActionMailer::Base.perform_deliveries = true - ActionMailer::Base.deliveries = [] +class TestHelperMailerTest < ActionMailer::TestCase + + def test_setup_sets_right_action_mailer_options + assert_equal :test, ActionMailer::Base.delivery_method + assert ActionMailer::Base.perform_deliveries + assert_equal [], ActionMailer::Base.deliveries + end + + def test_setup_creates_the_expected_mailer + assert @expected.is_a?(TMail::Mail) + assert_equal "1.0", @expected.mime_version + assert_equal "text/plain", @expected.content_type + end + + def test_mailer_class_is_correctly_inferred + assert_equal TestHelperMailer, self.class.mailer_class + end + + def test_determine_default_mailer_raises_correct_error + assert_raises(ActionMailer::NonInferrableMailerError) do + self.class.determine_default_mailer("NotAMailerTest") + end end + def test_charset_is_utf_8 + assert_equal "utf-8", charset + end + + def test_encode + assert_equal "=?utf-8?Q?=0aasdf=0a?=", encode("\nasdf\n") + end + def test_assert_emails assert_nothing_raised do assert_emails 1 do |