aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/base_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer/test/base_test.rb')
-rw-r--r--actionmailer/test/base_test.rb24
1 files changed, 10 insertions, 14 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index 57bfe2375e..20ecfdcbdb 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -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