2009-06-30 20:26:46 -04:00
|
|
|
ORIG_ARGV = ARGV.dup
|
2009-11-09 23:56:49 -05:00
|
|
|
|
2009-10-20 19:33:54 -04:00
|
|
|
begin
|
2009-11-09 23:56:49 -05:00
|
|
|
require File.expand_path('../../../vendor/gems/environment', __FILE__)
|
2009-10-20 19:33:54 -04:00
|
|
|
rescue LoadError
|
|
|
|
end
|
|
|
|
|
2009-11-10 00:28:36 -05:00
|
|
|
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
|
|
|
|
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
|
2009-11-09 23:56:49 -05:00
|
|
|
|
2006-07-08 14:14:49 -04:00
|
|
|
require 'test/unit'
|
2009-11-09 23:44:28 -05:00
|
|
|
require 'mocha'
|
2009-09-14 01:41:04 -04:00
|
|
|
|
2009-03-26 22:10:13 -04:00
|
|
|
ENV['NO_RELOAD'] = '1'
|
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
|
|
|
|
2009-09-07 22:56:53 -04:00
|
|
|
# Include shims until we get off 1.8.6
|
|
|
|
require 'active_support/ruby/shim'
|
|
|
|
|
2008-11-20 15:08:42 -05:00
|
|
|
def uses_memcached(test_name)
|
2009-09-24 21:36:40 -04:00
|
|
|
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
|