2009-07-01 00:26:46 +00:00
|
|
|
ORIG_ARGV = ARGV.dup
|
|
|
|
|
2009-09-14 03:55:46 +00:00
|
|
|
require 'rubygems'
|
2006-07-08 18:14:49 +00:00
|
|
|
require 'test/unit'
|
2009-02-04 02:25:37 +00:00
|
|
|
|
2009-03-27 02:10:13 +00:00
|
|
|
ENV['NO_RELOAD'] = '1'
|
2008-11-22 17:06:08 +00:00
|
|
|
$:.unshift "#{File.dirname(__FILE__)}/../lib"
|
2006-07-08 18:14:49 +00:00
|
|
|
require 'active_support'
|
2008-11-07 18:00:13 +00:00
|
|
|
require 'active_support/test_case'
|
2006-09-04 03:38:13 +00:00
|
|
|
|
2009-09-08 02:56:53 +00:00
|
|
|
# Include shims until we get off 1.8.6
|
|
|
|
require 'active_support/ruby/shim'
|
|
|
|
|
2008-11-20 20:08:42 +00:00
|
|
|
def uses_memcached(test_name)
|
2009-09-14 03:55:46 +00:00
|
|
|
require 'active_support/vendor/memcache'
|
2009-03-29 06:55:43 +00: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 20:30:46 +00:00
|
|
|
end
|
|
|
|
|
2008-09-21 15:22:55 +00: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 20:30:46 +00:00
|
|
|
end
|
2008-11-20 20:08:42 +00:00
|
|
|
|
|
|
|
# Show backtraces for deprecated behavior for quicker cleanup.
|
|
|
|
ActiveSupport::Deprecation.debug = true
|
|
|
|
|
|
|
|
if RUBY_VERSION < '1.9'
|
|
|
|
$KCODE = 'UTF8'
|
|
|
|
end
|