aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-07-28 12:03:16 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-07-28 12:03:16 +0100
commitde211914d84737c4314e862b459b9a23a0baa28f (patch)
tree3f04c940a4c821014332ddc4f119a81a37db3a33 /actionmailer/test
parent6246a8e06035973c88a38826ce1ee6b07b03b8dc (diff)
parent10d9fe4bf3110c1d5de0c6b509fe0cbb9d5eda1d (diff)
downloadrails-de211914d84737c4314e862b459b9a23a0baa28f.tar.gz
rails-de211914d84737c4314e862b459b9a23a0baa28f.tar.bz2
rails-de211914d84737c4314e862b459b9a23a0baa28f.zip
Merge commit 'mainstream/master'
Conflicts: actionpack/lib/action_controller/cookies.rb actionpack/lib/action_controller/streaming.rb actionpack/lib/action_controller/test_case.rb actionpack/lib/action_view/base.rb actionpack/lib/action_view/helpers/date_helper.rb actionpack/lib/action_view/helpers/debug_helper.rb actionpack/lib/action_view/helpers/form_options_helper.rb actionpack/lib/action_view/helpers/javascript_helper.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/validations.rb activeresource/README activesupport/lib/active_support/core_ext/hash/reverse_merge.rb activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone_info.rb activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone.rb railties/doc/guides/actionview/helpers.markdown railties/doc/guides/actionview/partials.markdown railties/doc/guides/activerecord/basics.markdown
Diffstat (limited to 'actionmailer/test')
-rw-r--r--actionmailer/test/abstract_unit.rb18
-rwxr-xr-xactionmailer/test/mail_service_test.rb6
2 files changed, 16 insertions, 8 deletions
diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb
index 11058a770d..107b2e8bbe 100644
--- a/actionmailer/test/abstract_unit.rb
+++ b/actionmailer/test/abstract_unit.rb
@@ -30,12 +30,20 @@ class Net::SMTP
end
end
-# Wrap tests that use Mocha and skip if unavailable.
-def uses_mocha(test_name)
- gem 'mocha', ">=0.9.0"
+def uses_gem(gem_name, test_name, version = '> 0')
+ require 'rubygems'
+ gem gem_name.to_s, version
+ require gem_name.to_s
yield
-rescue Gem::LoadError
- $stderr.puts "Skipping #{test_name} tests (Mocha >= 0.5 is required). `gem install mocha` and try again."
+rescue LoadError
+ $stderr.puts "Skipping #{test_name} tests. `gem install #{gem_name}` and try again."
+end
+
+# Wrap tests that use Mocha and skip if unavailable.
+unless defined? uses_mocha
+ def uses_mocha(test_name, &block)
+ uses_gem('mocha', test_name, '>= 0.5.5', &block)
+ end
end
def set_delivery_method(delivery_method)
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index 7f4a8817ca..e5ecb0e254 100755
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -942,13 +942,13 @@ end # uses_mocha
class InheritableTemplateRootTest < Test::Unit::TestCase
def test_attr
expected = "#{File.dirname(__FILE__)}/fixtures/path.with.dots"
- assert_equal [expected], FunkyPathMailer.template_root.map(&:to_s)
+ assert_equal expected, FunkyPathMailer.template_root
sub = Class.new(FunkyPathMailer)
sub.template_root = 'test/path'
- assert_equal ['test/path'], sub.template_root.map(&:to_s)
- assert_equal [expected], FunkyPathMailer.template_root.map(&:to_s)
+ assert_equal 'test/path', sub.template_root
+ assert_equal expected, FunkyPathMailer.template_root
end
end