diff options
Diffstat (limited to 'activesupport/test/abstract_unit.rb')
-rw-r--r-- | activesupport/test/abstract_unit.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index cce8d5d220..a698beaa0e 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -1,9 +1,15 @@ +# encoding: utf-8 + require 'test/unit' $:.unshift "#{File.dirname(__FILE__)}/../lib" $:.unshift File.dirname(__FILE__) require 'active_support' +if RUBY_VERSION < '1.9' + $KCODE = 'UTF8' +end + def uses_gem(gem_name, test_name, version = '> 0') require 'rubygems' gem gem_name.to_s, version @@ -22,3 +28,16 @@ end # Show backtraces for deprecated behavior for quicker cleanup. ActiveSupport::Deprecation.debug = true + +def with_kcode(code) + if RUBY_VERSION < '1.9' + begin + old_kcode, $KCODE = $KCODE, code + yield + ensure + $KCODE = old_kcode + end + else + yield + end +end
\ No newline at end of file |