2010-06-21 13:02:04 -04:00
|
|
|
ORIG_ARGV = ARGV.dup
|
|
|
|
|
2010-03-17 03:53:48 -04:00
|
|
|
begin
|
|
|
|
old, $VERBOSE = $VERBOSE, nil
|
|
|
|
require File.expand_path('../../../load_paths', __FILE__)
|
|
|
|
ensure
|
|
|
|
$VERBOSE = old
|
|
|
|
end
|
2009-11-09 23:56:49 -05:00
|
|
|
|
2010-02-28 19:16:57 -05:00
|
|
|
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
|
|
|
|
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
|
|
|
|
|
2010-08-22 17:43:31 -04:00
|
|
|
require 'active_support/core_ext/kernel/reporting'
|
|
|
|
|
2010-08-22 01:23:13 -04:00
|
|
|
require 'active_support/core_ext/string/encoding'
|
|
|
|
if "ruby".encoding_aware?
|
|
|
|
# These are the normal settings that will be set up by Railties
|
|
|
|
# TODO: Have these tests support other combinations of these values
|
2010-08-22 17:43:31 -04:00
|
|
|
silence_warnings do
|
|
|
|
Encoding.default_internal = "UTF-8"
|
|
|
|
Encoding.default_external = "UTF-8"
|
|
|
|
end
|
2010-08-22 01:23:13 -04:00
|
|
|
end
|
|
|
|
|
2006-07-08 14:14:49 -04:00
|
|
|
require 'test/unit'
|
2010-03-30 19:53:44 -04:00
|
|
|
require 'empty_bool'
|
2010-03-17 03:53:48 -04:00
|
|
|
|
|
|
|
silence_warnings { 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'
|
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
|
2010-02-16 14:43:13 -05:00
|
|
|
require 'active_support/ruby/shim' if RUBY_VERSION < '1.8.7'
|
2009-09-07 22:56:53 -04:00
|
|
|
|
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
|
2010-06-21 12:19:12 -04:00
|
|
|
MemCache.new('localhost:11211').stats
|
2009-03-29 02:55:43 -04:00
|
|
|
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
|