2010-02-24 01:31:17 +00:00
|
|
|
require File.expand_path('../../../load_paths', __FILE__)
|
2009-11-10 04:56:49 +00:00
|
|
|
|
2006-07-08 18:14:49 +00:00
|
|
|
require 'test/unit'
|
2009-11-10 04:44:28 +00:00
|
|
|
require 'mocha'
|
2009-09-14 05:41:04 +00:00
|
|
|
|
2009-03-27 02:10:13 +00:00
|
|
|
ENV['NO_RELOAD'] = '1'
|
2006-07-08 18:14:49 +00:00
|
|
|
require 'active_support'
|
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-25 01:36:40 +00:00
|
|
|
require '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
|