2008-11-20 15:08:42 -05:00
|
|
|
require 'rubygems'
|
2006-07-08 14:14:49 -04:00
|
|
|
require 'test/unit'
|
2009-02-03 21:25:37 -05:00
|
|
|
|
|
|
|
gem 'mocha', '>= 0.9.5'
|
2008-11-20 15:08:42 -05:00
|
|
|
require 'mocha'
|
2006-07-08 14:14:49 -04:00
|
|
|
|
2009-03-26 22:10:13 -04:00
|
|
|
ENV['NO_RELOAD'] = '1'
|
2008-11-22 12:06:08 -05:00
|
|
|
$:.unshift "#{File.dirname(__FILE__)}/../lib"
|
2006-07-08 14:14:49 -04:00
|
|
|
require 'active_support'
|
2008-11-07 13:00:13 -05:00
|
|
|
require 'active_support/test_case'
|
2006-09-03 23:38:13 -04:00
|
|
|
|
2008-11-20 15:08:42 -05:00
|
|
|
def uses_memcached(test_name)
|
|
|
|
require 'memcache'
|
2009-03-29 02:55:43 -04:00
|
|
|
begin
|
|
|
|
MemCache.new('localhost').stats
|
|
|
|
yield
|
|
|
|
rescue MemCache::MemCacheError
|
|
|
|
$stderr.puts "Skipping #{test_name} tests. Start memcached and try again."
|
|
|
|
end
|
2008-10-14 16:30:46 -04:00
|
|
|
end
|
|
|
|
|
2008-09-21 11:22:55 -04:00
|
|
|
def with_kcode(code)
|
|
|
|
if RUBY_VERSION < '1.9'
|
|
|
|
begin
|
|
|
|
old_kcode, $KCODE = $KCODE, code
|
|
|
|
yield
|
|
|
|
ensure
|
|
|
|
$KCODE = old_kcode
|
|
|
|
end
|
|
|
|
else
|
|
|
|
yield
|
|
|
|
end
|
2008-10-14 16:30:46 -04:00
|
|
|
end
|
2008-11-20 15:08:42 -05:00
|
|
|
|
|
|
|
# Show backtraces for deprecated behavior for quicker cleanup.
|
|
|
|
ActiveSupport::Deprecation.debug = true
|
|
|
|
|
|
|
|
if RUBY_VERSION < '1.9'
|
|
|
|
$KCODE = 'UTF8'
|
|
|
|
end
|