From 9f01dff9c203821bf4ac6d7b885f1d6b018d5c79 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Sun, 31 Jan 2010 16:33:06 -0800 Subject: Get rails tests running on bundler 0.9 --- actionmailer/test/abstract_unit.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'actionmailer/test') diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index ce09bb5d61..8fb941f9c9 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -1,12 +1,5 @@ -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' -- cgit v1.2.3 From e5ab4b0d07ade8d89d633ca744c0eafbc53ee921 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 31 Jan 2010 18:32:28 -0800 Subject: Convert to class_attribute --- actionmailer/test/base_test.rb | 24 ++++++++++-------------- actionmailer/test/delivery_methods_test.rb | 6 ++++-- 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'actionmailer/test') 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 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 -- cgit v1.2.3 From d74b5e440c04a1d89ae092cab7cb4d93d850f94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 1 Feb 2010 23:34:23 +0100 Subject: Make AM test suite green. --- actionmailer/test/abstract_unit.rb | 1 + actionmailer/test/base_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'actionmailer/test') diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index 8fb941f9c9..f6baa4a9e8 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -2,6 +2,7 @@ require File.expand_path('../../../load_paths', __FILE__) 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 20ecfdcbdb..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 -- cgit v1.2.3