aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-07-19 11:14:12 -0500
committerJoshua Peek <josh@joshpeek.com>2008-07-19 11:14:12 -0500
commitb74b97fef5d94f91d6fbf9aec20516c7fe4ce24d (patch)
treeecd858af818ff85eb36ef4b040de2440b87e5814 /actionmailer
parent8c2e839e5a0fb1662ae867c70114c3fc91850a55 (diff)
downloadrails-b74b97fef5d94f91d6fbf9aec20516c7fe4ce24d.tar.gz
rails-b74b97fef5d94f91d6fbf9aec20516c7fe4ce24d.tar.bz2
rails-b74b97fef5d94f91d6fbf9aec20516c7fe4ce24d.zip
Update uses_mocha in ActionMailer and ActiveResource
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/test/abstract_unit.rb18
1 files changed, 13 insertions, 5 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)