aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-10-26 02:21:21 +0000
committerMichael Koziarski <michael@koziarski.com>2007-10-26 02:21:21 +0000
commit2cc0cac3efce92bf9d0e8636f2889c37ca9f57ab (patch)
tree3ad613f6c73cd9fef243f7586dfcf3b6f329105b /actionmailer/test
parent2bfd6772a4f3f9e0ff395cfd415dafbc1c9dec80 (diff)
downloadrails-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')
-rw-r--r--actionmailer/test/abstract_unit.rb1
-rw-r--r--actionmailer/test/test_helper_test.rb35
2 files changed, 31 insertions, 5 deletions
diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb
index 649e7982cc..0a73b1b462 100644
--- a/actionmailer/test/abstract_unit.rb
+++ b/actionmailer/test/abstract_unit.rb
@@ -2,6 +2,7 @@ require 'test/unit'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'action_mailer'
+require 'action_mailer/test_case'
# Show backtraces for deprecated behavior for quicker cleanup.
ActiveSupport::Deprecation.debug = true
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