diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-06-30 05:27:05 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-06-30 05:27:05 +0000 |
commit | 5446ecd5b975890dab5f7120b25ed0e8f91279fa (patch) | |
tree | 5c030b83d08e5228389c2600b769166118cb3a2f /actionmailer/test | |
parent | bdac94e990162d711529922cf32adca2f0836905 (diff) | |
download | rails-5446ecd5b975890dab5f7120b25ed0e8f91279fa.tar.gz rails-5446ecd5b975890dab5f7120b25ed0e8f91279fa.tar.bz2 rails-5446ecd5b975890dab5f7120b25ed0e8f91279fa.zip |
Mailer template root applies to a class and its subclasses rather than acting globally. Closes #5555.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4523 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/mail_helper_test.rb | 8 | ||||
-rw-r--r-- | actionmailer/test/mail_render_test.rb | 7 | ||||
-rwxr-xr-x | actionmailer/test/mail_service_test.rb | 26 | ||||
-rw-r--r-- | actionmailer/test/quoting_test.rb | 5 | ||||
-rw-r--r-- | actionmailer/test/tmail_test.rb | 6 |
5 files changed, 19 insertions, 33 deletions
diff --git a/actionmailer/test/mail_helper_test.rb b/actionmailer/test/mail_helper_test.rb index bf5bf7f3ac..19f3707db8 100644 --- a/actionmailer/test/mail_helper_test.rb +++ b/actionmailer/test/mail_helper_test.rb @@ -1,8 +1,4 @@ -$:.unshift(File.dirname(__FILE__) + "/../lib/") -$:.unshift File.dirname(__FILE__) + "/fixtures/helpers" - -require 'test/unit' -require 'action_mailer' +require "#{File.dirname(__FILE__)}/abstract_unit" module MailerHelper def person_name @@ -56,8 +52,6 @@ class HelperMailer < ActionMailer::Base helper_method :name_of_the_mailer_class end -HelperMailer.template_root = File.dirname(__FILE__) + "/fixtures" - class MailerHelperTest < Test::Unit::TestCase def new_mail( charset="utf-8" ) mail = TMail::Mail.new diff --git a/actionmailer/test/mail_render_test.rb b/actionmailer/test/mail_render_test.rb index 11ac4d1ed8..42454fef6e 100644 --- a/actionmailer/test/mail_render_test.rb +++ b/actionmailer/test/mail_render_test.rb @@ -1,7 +1,4 @@ -$:.unshift(File.dirname(__FILE__) + "/../lib/") - -require 'test/unit' -require 'action_mailer' +require "#{File.dirname(__FILE__)}/abstract_unit" class RenderMailer < ActionMailer::Base def inline_template(recipient) @@ -40,8 +37,6 @@ class SecondMailer < ActionMailer::Base end end -RenderMailer.template_root = File.dirname(__FILE__) + "/fixtures" - class RenderHelperTest < Test::Unit::TestCase def setup ActionMailer::Base.delivery_method = :test diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index aa9002a262..bcce81e3aa 100755 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -1,7 +1,4 @@ -$:.unshift(File.dirname(__FILE__) + "/../lib/") - -require 'test/unit' -require 'action_mailer' +require "#{File.dirname(__FILE__)}/abstract_unit" class MockSMTP def self.deliveries @@ -24,6 +21,8 @@ class Net::SMTP end class FunkyPathMailer < ActionMailer::Base + self.template_root = "#{File.dirname(__FILE__)}/fixtures/path.with.dots" + def multipart_with_template_path_with_dots(recipient) recipients recipient subject "Have a lovely picture" @@ -31,14 +30,9 @@ class FunkyPathMailer < ActionMailer::Base attachment :content_type => "image/jpeg", :body => "not really a jpeg, we're only testing, after all" end - - def template_root - "#{File.dirname(__FILE__)}/fixtures/path.with.dots" - end end class TestMailer < ActionMailer::Base - def signed_up(recipient) @recipients = recipient @subject = "[Signed up] Welcome #{recipient}" @@ -271,8 +265,6 @@ class TestMailer < ActionMailer::Base end end -TestMailer.template_root = File.dirname(__FILE__) + "/fixtures" - class ActionMailerTest < Test::Unit::TestCase include ActionMailer::Quoting @@ -816,3 +808,15 @@ EOF end end +class InheritableTemplateRootTest < Test::Unit::TestCase + def test_attr + expected = "#{File.dirname(__FILE__)}/fixtures/path.with.dots" + assert_equal expected, FunkyPathMailer.template_root + + sub = Class.new(FunkyPathMailer) + sub.template_root = 'test/path' + + assert_equal 'test/path', sub.template_root + assert_equal expected, FunkyPathMailer.template_root + end +end diff --git a/actionmailer/test/quoting_test.rb b/actionmailer/test/quoting_test.rb index 6291cd3db6..0b145b1f77 100644 --- a/actionmailer/test/quoting_test.rb +++ b/actionmailer/test/quoting_test.rb @@ -1,7 +1,4 @@ -$:.unshift(File.dirname(__FILE__) + "/../lib/") -$:.unshift(File.dirname(__FILE__) + "/../lib/action_mailer/vendor") - -require 'test/unit' +require "#{File.dirname(__FILE__)}/abstract_unit" require 'tmail' require 'tempfile' diff --git a/actionmailer/test/tmail_test.rb b/actionmailer/test/tmail_test.rb index 3930c7d39a..7d83a68ac7 100644 --- a/actionmailer/test/tmail_test.rb +++ b/actionmailer/test/tmail_test.rb @@ -1,8 +1,4 @@ -$:.unshift(File.dirname(__FILE__) + "/../lib/") -$:.unshift File.dirname(__FILE__) + "/fixtures/helpers" - -require 'test/unit' -require 'action_mailer' +require "#{File.dirname(__FILE__)}/abstract_unit" class TMailMailTest < Test::Unit::TestCase def test_body |