aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-02-01 23:42:38 +0000
committerPratik Naik <pratiknaik@gmail.com>2010-02-01 23:42:38 +0000
commitfdcf4d6c5191b25ee3b6c357dafaf17156eb09d3 (patch)
tree347f771202054a443f9df23a8f65f91d49a52209 /actionmailer/test
parent27fa38cc3e162b2f8c4bb2d50130fbc17bad6039 (diff)
parent16c0d1d3b6089bb4b0b0baf7c3eeb5949f31f02b (diff)
downloadrails-fdcf4d6c5191b25ee3b6c357dafaf17156eb09d3.tar.gz
rails-fdcf4d6c5191b25ee3b6c357dafaf17156eb09d3.tar.bz2
rails-fdcf4d6c5191b25ee3b6c357dafaf17156eb09d3.zip
Merge remote branch 'mainstream/master'
Diffstat (limited to 'actionmailer/test')
-rw-r--r--actionmailer/test/abstract_unit.rb10
-rw-r--r--actionmailer/test/base_test.rb28
-rw-r--r--actionmailer/test/delivery_methods_test.rb6
3 files changed, 18 insertions, 26 deletions
diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb
index ce09bb5d61..f6baa4a9e8 100644
--- a/actionmailer/test/abstract_unit.rb
+++ b/actionmailer/test/abstract_unit.rb
@@ -1,14 +1,8 @@
-begin
- require File.expand_path('../../../vendor/gems/environment', __FILE__)
-rescue LoadError
-end
-
-lib = File.expand_path('../../lib', __FILE__)
-$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
+require File.expand_path('../../../load_paths', __FILE__)
-require 'rubygems'
require 'test/unit'
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/base_test.rb b/actionmailer/test/base_test.rb
index 57bfe2375e..7e794e10e8 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -81,8 +81,8 @@ class BaseTest < ActiveSupport::TestCase
def different_template(template_name='')
mail do |format|
- format.text { render :template => template_name }
- format.html { render :template => template_name }
+ format.text { render :template => "#{mailer_name}/#{template_name}" }
+ format.html { render :template => "#{mailer_name}/#{template_name}" }
end
end
@@ -254,7 +254,7 @@ class BaseTest < ActiveSupport::TestCase
end
test "subject gets default from I18n" do
- BaseMailer.default[:subject] = nil
+ BaseMailer.default :subject => nil
email = BaseMailer.welcome(:subject => nil)
assert_equal "Welcome", email.subject
@@ -331,22 +331,24 @@ class BaseTest < ActiveSupport::TestCase
end
test "implicit multipart with several view paths uses the first one with template" do
+ old = BaseMailer.view_paths
begin
- BaseMailer.view_paths.unshift(File.join(FIXTURE_LOAD_PATH, "another.path"))
+ BaseMailer.view_paths = [File.join(FIXTURE_LOAD_PATH, "another.path")] + old.dup
email = BaseMailer.welcome
assert_equal("Welcome from another path", email.body.encoded)
ensure
- BaseMailer.view_paths.shift
+ BaseMailer.view_paths = old
end
end
test "implicit multipart with inexistent templates uses the next view path" do
+ old = BaseMailer.view_paths
begin
- BaseMailer.view_paths.unshift(File.join(FIXTURE_LOAD_PATH, "unknown"))
+ BaseMailer.view_paths = [File.join(FIXTURE_LOAD_PATH, "unknown")] + old.dup
email = BaseMailer.welcome
assert_equal("Welcome", email.body.encoded)
ensure
- BaseMailer.view_paths.shift
+ BaseMailer.view_paths = old
end
end
@@ -503,16 +505,10 @@ class BaseTest < ActiveSupport::TestCase
end
def with_default(klass, new_values)
- hash = klass.default
- old_values = {}
- new_values.each do |key, value|
- old_values[key] = hash[key]
- hash[key] = value
- end
+ old = klass.default_params
+ klass.default(new_values)
yield
ensure
- old_values.each do |key, value|
- hash[key] = value
- end
+ klass.default_params = old
end
end
diff --git a/actionmailer/test/delivery_methods_test.rb b/actionmailer/test/delivery_methods_test.rb
index 4907ca0903..22a7d19bc2 100644
--- a/actionmailer/test/delivery_methods_test.rb
+++ b/actionmailer/test/delivery_methods_test.rb
@@ -45,7 +45,9 @@ class CustomDeliveryMethodsTest < ActiveSupport::TestCase
def teardown
ActionMailer::Base.delivery_method = @old_delivery_method
- ActionMailer::Base.delivery_methods.delete(:custom)
+ new = ActionMailer::Base.delivery_methods.dup
+ new.delete(:custom)
+ ActionMailer::Base.delivery_methods = new
end
test "allow to add custom delivery method" do
@@ -167,4 +169,4 @@ class MailDeliveryTest < ActiveSupport::TestCase
assert_equal(0, DeliveryMailer.deliveries.length)
end
-end \ No newline at end of file
+end