2006-07-08 14:14:49 -04:00
|
|
|
require 'test/unit'
|
|
|
|
|
|
|
|
$:.unshift "#{File.dirname(__FILE__)}/../lib"
|
2007-09-27 06:19:48 -04:00
|
|
|
$:.unshift File.dirname(__FILE__)
|
2006-07-08 14:14:49 -04:00
|
|
|
require 'active_support'
|
2006-09-03 23:38:13 -04:00
|
|
|
|
2008-01-20 22:55:54 -05:00
|
|
|
def uses_gem(gem_name, test_name, version = '> 0')
|
|
|
|
require 'rubygems'
|
|
|
|
gem gem_name.to_s, version
|
|
|
|
require gem_name.to_s
|
|
|
|
yield
|
|
|
|
rescue LoadError
|
|
|
|
$stderr.puts "Skipping #{test_name} tests. `gem install #{gem_name}` and try again."
|
|
|
|
end
|
|
|
|
|
2007-09-15 17:39:04 -04:00
|
|
|
# Wrap tests that use Mocha and skip if unavailable.
|
2007-10-07 05:15:26 -04:00
|
|
|
unless defined? uses_mocha
|
2008-01-20 22:55:54 -05:00
|
|
|
def uses_mocha(test_name, &block)
|
|
|
|
uses_gem('mocha', test_name, '>= 0.5.5', &block)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2006-09-03 23:38:13 -04:00
|
|
|
# Show backtraces for deprecated behavior for quicker cleanup.
|
|
|
|
ActiveSupport::Deprecation.debug = true
|