aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-03-26 15:10:24 -0700
committerwycats <wycats@gmail.com>2010-03-26 15:10:24 -0700
commit197904341f2b2f21d69c653cede3aec124e86720 (patch)
tree83f1234e238016126860a929594db22e1862d783 /activesupport
parent76d2c455c0607b4cd5f238cadef8f933a18567fb (diff)
parentb3a0aed028835ce4551c4a76742744a40a71b0be (diff)
downloadrails-197904341f2b2f21d69c653cede3aec124e86720.tar.gz
rails-197904341f2b2f21d69c653cede3aec124e86720.tar.bz2
rails-197904341f2b2f21d69c653cede3aec124e86720.zip
Merge branch 'master' into docrails
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/activesupport.gemspec4
-rw-r--r--activesupport/lib/active_support/core_ext/class/attribute.rb3
-rw-r--r--activesupport/lib/active_support/core_ext/class/delegating_attributes.rb5
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/conversions.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/hash/conversions.rb9
-rw-r--r--activesupport/lib/active_support/core_ext/module.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/module/delegation.rb8
-rw-r--r--activesupport/lib/active_support/core_ext/module/method_names.rb14
-rw-r--r--activesupport/lib/active_support/core_ext/module/remove_method.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/string/inflections.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/string/output_safety.rb9
-rw-r--r--activesupport/lib/active_support/core_ext/time/conversions.rb1
-rw-r--r--activesupport/lib/active_support/inflector/transliterate.rb4
-rw-r--r--activesupport/lib/active_support/multibyte.rb4
-rw-r--r--activesupport/lib/active_support/multibyte/utils.rb2
-rw-r--r--activesupport/lib/active_support/notifications/fanout.rb2
-rw-r--r--activesupport/lib/active_support/railtie.rb6
-rw-r--r--activesupport/lib/active_support/ruby/shim.rb1
-rw-r--r--activesupport/lib/active_support/test_case.rb3
-rw-r--r--activesupport/lib/active_support/testing/isolation.rb4
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb4
-rw-r--r--activesupport/test/abstract_unit.rb11
-rw-r--r--activesupport/test/callback_inheritance_test.rb1
-rw-r--r--activesupport/test/callbacks_test.rb2
-rw-r--r--activesupport/test/core_ext/class/delegating_attributes_test.rb22
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb4
-rw-r--r--activesupport/test/core_ext/module_test.rb14
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb2
-rw-r--r--activesupport/test/dependencies_test.rb2
-rw-r--r--activesupport/test/flush_cache_on_private_memoization_test.rb1
-rw-r--r--activesupport/test/inflector_test_cases.rb16
-rw-r--r--activesupport/test/notifications_test.rb6
-rw-r--r--activesupport/test/ts_isolated.rb2
33 files changed, 125 insertions, 54 deletions
diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec
index 78fb48924e..bfb1e83002 100644
--- a/activesupport/activesupport.gemspec
+++ b/activesupport/activesupport.gemspec
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
s.has_rdoc = true
- s.add_dependency('i18n', '~> 0.3.6.pre')
+ s.add_dependency('i18n', '~> 0.3.6')
s.add_dependency('tzinfo', '~> 0.3.16')
s.add_dependency('builder', '~> 2.1.2')
- s.add_dependency('memcache-client', '~> 1.7.5')
+ s.add_dependency('memcache-client', '>= 1.7.5')
end
diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb
index c18905b369..9631a7d242 100644
--- a/activesupport/lib/active_support/core_ext/class/attribute.rb
+++ b/activesupport/lib/active_support/core_ext/class/attribute.rb
@@ -1,5 +1,6 @@
require 'active_support/core_ext/object/singleton_class'
require 'active_support/core_ext/module/delegation'
+require 'active_support/core_ext/module/remove_method'
class Class
# Declare a class-level attribute whose value is inheritable and
@@ -45,12 +46,14 @@ class Class
s.send(:define_method, attr) { }
s.send(:define_method, :"#{attr}?") { !!send(attr) }
s.send(:define_method, :"#{attr}=") do |value|
+ singleton_class.remove_possible_method(attr)
singleton_class.send(:define_method, attr) { value }
end
define_method(attr) { self.class.send(attr) }
define_method(:"#{attr}?") { !!send(attr) }
define_method(:"#{attr}=") do |value|
+ singleton_class.remove_possible_method(attr)
singleton_class.send(:define_method, attr) { value }
end if instance_writer
end
diff --git a/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb b/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
index b5785bdcd3..12caa76c98 100644
--- a/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
+++ b/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
@@ -1,6 +1,7 @@
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/array/extract_options'
require 'active_support/core_ext/object/singleton_class'
+require 'active_support/core_ext/module/remove_method'
class Class
def superclass_delegating_accessor(name, options = {})
@@ -27,7 +28,9 @@ private
# inheritance behavior, without having to store the object in an instance
# variable and look up the superclass chain manually.
def _stash_object_in_method(object, method, instance_reader = true)
+ singleton_class.remove_possible_method(method)
singleton_class.send(:define_method, method) { object }
+ remove_possible_method(method)
define_method(method) { object } if instance_reader
end
@@ -35,7 +38,7 @@ private
singleton_class.send(:define_method, "#{name}=") do |value|
_stash_object_in_method(value, name, options[:instance_reader] != false)
end
- self.send("#{name}=", nil)
+ send("#{name}=", nil)
end
end
diff --git a/activesupport/lib/active_support/core_ext/date_time/conversions.rb b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
index 47a31839a6..a9f821b01e 100644
--- a/activesupport/lib/active_support/core_ext/date_time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
@@ -1,4 +1,5 @@
require 'active_support/inflector'
+require 'active_support/core_ext/time/conversions'
class DateTime
# Ruby 1.9 has DateTime#to_time which internally relies on Time. We define our own #to_time which allows
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index 48b185d05e..c882434f78 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -54,6 +54,15 @@ class Hash
"string" => Proc.new { |string| string.to_s },
"yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml },
"base64Binary" => Proc.new { |bin| ActiveSupport::Base64.decode64(bin) },
+ "binary" => Proc.new do |bin, entity|
+ case entity['encoding']
+ when 'base64'
+ ActiveSupport::Base64.decode64(bin)
+ # TODO: Add support for other encodings
+ else
+ bin
+ end
+ end,
"file" => Proc.new do |file, entity|
f = StringIO.new(ActiveSupport::Base64.decode64(file))
f.extend(FileLike)
diff --git a/activesupport/lib/active_support/core_ext/module.rb b/activesupport/lib/active_support/core_ext/module.rb
index bf272e9e73..f59fcd123c 100644
--- a/activesupport/lib/active_support/core_ext/module.rb
+++ b/activesupport/lib/active_support/core_ext/module.rb
@@ -7,4 +7,6 @@ require 'active_support/core_ext/module/attr_internal'
require 'active_support/core_ext/module/attr_accessor_with_default'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/module/synchronization'
-require 'active_support/core_ext/module/deprecation' \ No newline at end of file
+require 'active_support/core_ext/module/deprecation'
+require 'active_support/core_ext/module/remove_method'
+require 'active_support/core_ext/module/method_names' \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb
index 381181b2f4..b73f4c2b59 100644
--- a/activesupport/lib/active_support/core_ext/module/delegation.rb
+++ b/activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -1,3 +1,5 @@
+require "active_support/core_ext/module/remove_method"
+
class Module
# Provides a delegate class method to easily expose contained objects' methods
# as your own. Pass one or more methods (specified as symbols or strings)
@@ -39,7 +41,7 @@ class Module
# class Foo
# CONSTANT_ARRAY = [0,1,2,3]
# @@class_array = [4,5,6,7]
- #
+ #
# def initialize
# @instance_array = [8,9,10,11]
# end
@@ -125,6 +127,10 @@ class Module
end
module_eval(<<-EOS, file, line)
+ if instance_methods(false).map(&:to_s).include?("#{prefix}#{method}")
+ remove_possible_method("#{prefix}#{method}")
+ end
+
def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block)
#{to}.__send__(#{method.inspect}, *args, &block) # client.__send__(:name, *args, &block)
rescue NoMethodError # rescue NoMethodError
diff --git a/activesupport/lib/active_support/core_ext/module/method_names.rb b/activesupport/lib/active_support/core_ext/module/method_names.rb
new file mode 100644
index 0000000000..2eb40a83ab
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/module/method_names.rb
@@ -0,0 +1,14 @@
+class Module
+ if instance_methods[0].is_a?(Symbol)
+ def instance_method_names(*args)
+ instance_methods(*args).map(&:to_s)
+ end
+
+ def method_names(*args)
+ methods(*args).map(&:to_s)
+ end
+ else
+ alias_method :instance_method_names, :instance_methods
+ alias_method :method_names, :methods
+ end
+end \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/module/remove_method.rb b/activesupport/lib/active_support/core_ext/module/remove_method.rb
new file mode 100644
index 0000000000..2714a46b28
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/module/remove_method.rb
@@ -0,0 +1,6 @@
+class Module
+ def remove_possible_method(method)
+ remove_method(method)
+ rescue NameError
+ end
+end \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb
index fbb7b79fc6..48b028bb64 100644
--- a/activesupport/lib/active_support/core_ext/string/inflections.rb
+++ b/activesupport/lib/active_support/core_ext/string/inflections.rb
@@ -1,5 +1,3 @@
-require 'active_support/inflector'
-
# String inflections define new methods on the String class to transform names for different purposes.
# For instance, you can figure out the name of a database from the name of a class.
#
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb
index 9a7c520e75..3ee5bcaab4 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -1,4 +1,5 @@
-require "erb"
+require 'erb'
+require 'active_support/core_ext/object/singleton_class'
class ERB
module Util
@@ -23,12 +24,14 @@ class ERB
end
end
- undef :h
+ remove_method(:h)
alias h html_escape
- module_function :html_escape
module_function :h
+ singleton_class.send(:remove_method, :html_escape)
+ module_function :html_escape
+
# A utility method for escaping HTML entities in JSON strings.
# This method is also aliased as <tt>j</tt>.
#
diff --git a/activesupport/lib/active_support/core_ext/time/conversions.rb b/activesupport/lib/active_support/core_ext/time/conversions.rb
index 6d9c080442..86103ebce2 100644
--- a/activesupport/lib/active_support/core_ext/time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/time/conversions.rb
@@ -1,4 +1,5 @@
require 'active_support/inflector'
+require 'active_support/core_ext/time/publicize_conversion_methods'
require 'active_support/values/time_zone'
class Time
diff --git a/activesupport/lib/active_support/inflector/transliterate.rb b/activesupport/lib/active_support/inflector/transliterate.rb
index 236f2eb628..2ce27cf406 100644
--- a/activesupport/lib/active_support/inflector/transliterate.rb
+++ b/activesupport/lib/active_support/inflector/transliterate.rb
@@ -14,8 +14,8 @@ module ActiveSupport
if RUBY_VERSION >= '1.9'
undef_method :transliterate
def transliterate(string)
- warn "Ruby 1.9 doesn't support Unicode normalization yet"
- string.dup
+ proxy = ActiveSupport::Multibyte.proxy_class.new(string)
+ proxy.normalize(:kd).gsub(/[^\x00-\x7F]+/, '')
end
# The iconv transliteration code doesn't function correctly
diff --git a/activesupport/lib/active_support/multibyte.rb b/activesupport/lib/active_support/multibyte.rb
index 7e6f7d754b..428c48a484 100644
--- a/activesupport/lib/active_support/multibyte.rb
+++ b/activesupport/lib/active_support/multibyte.rb
@@ -53,8 +53,8 @@ module ActiveSupport #:nodoc:
\xf4 [\x80-\x8f] [\x80-\xbf] [\x80-\xbf])\z /xn,
# Quick check for valid Shift-JIS characters, disregards the odd-even pairing
'Shift_JIS' => /\A(?:
- [\x00-\x7e \xa1-\xdf] |
- [\x81-\x9f \xe0-\xef] [\x40-\x7e \x80-\x9e \x9f-\xfc])\z /xn
+ [\x00-\x7e\xa1-\xdf] |
+ [\x81-\x9f\xe0-\xef] [\x40-\x7e\x80-\x9e\x9f-\xfc])\z /xn
}
end
end
diff --git a/activesupport/lib/active_support/multibyte/utils.rb b/activesupport/lib/active_support/multibyte/utils.rb
index b243df46d8..94b393cee2 100644
--- a/activesupport/lib/active_support/multibyte/utils.rb
+++ b/activesupport/lib/active_support/multibyte/utils.rb
@@ -27,7 +27,7 @@ module ActiveSupport #:nodoc:
def self.verify(string)
if expression = valid_character
# Splits the string on character boundaries, which are determined based on $KCODE.
- string.split(//).all? { |c| expression.match(c) }
+ string.split(//).all? { |c| expression =~ c }
else
true
end
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb
index cd60054862..a3ddc7705a 100644
--- a/activesupport/lib/active_support/notifications/fanout.rb
+++ b/activesupport/lib/active_support/notifications/fanout.rb
@@ -44,7 +44,7 @@ module ActiveSupport
when Regexp, NilClass
pattern
else
- /^#{Regexp.escape(pattern.to_s)}/
+ /^#{Regexp.escape(pattern.to_s)}$/
end
end
diff --git a/activesupport/lib/active_support/railtie.rb b/activesupport/lib/active_support/railtie.rb
index d2c13e030d..e45d16ee96 100644
--- a/activesupport/lib/active_support/railtie.rb
+++ b/activesupport/lib/active_support/railtie.rb
@@ -3,7 +3,7 @@ require "rails"
module ActiveSupport
class Railtie < Rails::Railtie
- railtie_name :active_support
+ config.active_support = ActiveSupport::OrderedOptions.new
# Loads support for "whiny nil" (noisy warnings when methods are invoked
# on +nil+ values) if Configuration#whiny_nils is true.
@@ -30,9 +30,7 @@ end
module I18n
class Railtie < Rails::Railtie
- railtie_name :i18n
-
- # Initialize I18n load paths to an array
+ config.i18n = ActiveSupport::OrderedOptions.new
config.i18n.railties_load_path = []
config.i18n.load_path = []
diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb
index f0db5b3021..4a9ac920e8 100644
--- a/activesupport/lib/active_support/ruby/shim.rb
+++ b/activesupport/lib/active_support/ruby/shim.rb
@@ -18,3 +18,4 @@ require 'active_support/core_ext/string/interpolation'
require 'active_support/core_ext/rexml'
require 'active_support/core_ext/time/conversions'
require 'active_support/core_ext/file/path'
+require 'active_support/core_ext/module/method_names' \ No newline at end of file
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb
index ab30984d62..ed8c02ba3e 100644
--- a/activesupport/lib/active_support/test_case.rb
+++ b/activesupport/lib/active_support/test_case.rb
@@ -5,9 +5,10 @@ require 'active_support/testing/deprecation'
require 'active_support/testing/declarative'
require 'active_support/testing/pending'
require 'active_support/testing/isolation'
+require 'active_support/core_ext/kernel/reporting'
begin
- require 'mocha'
+ silence_warnings { require 'mocha' }
rescue LoadError
# Fake Mocha::ExpectationError so we can rescue it in #run. Bleh.
Object.const_set :Mocha, Module.new
diff --git a/activesupport/lib/active_support/testing/isolation.rb b/activesupport/lib/active_support/testing/isolation.rb
index 453f4fcc0f..9507dbf473 100644
--- a/activesupport/lib/active_support/testing/isolation.rb
+++ b/activesupport/lib/active_support/testing/isolation.rb
@@ -78,8 +78,8 @@ module ActiveSupport
@@ran_class_setup = true
end
- serialized = run_in_isolation do |runner|
- super(runner)
+ serialized = run_in_isolation do |isolated_runner|
+ super(isolated_runner)
end
retval, proxy = Marshal.load(serialized)
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 4db3dd1705..3cb4d89e02 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -305,8 +305,8 @@ module ActiveSupport
# TODO: Preload instead of lazy load for thread safety
def tzinfo
- require 'tzinfo' unless defined?(TZInfo)
- @tzinfo ||= TZInfo::Timezone.get(MAPPING[name])
+ require 'tzinfo' unless defined?(::TZInfo)
+ @tzinfo ||= ::TZInfo::Timezone.get(MAPPING[name])
end
unless const_defined?(:ZONES)
diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb
index da338a2a26..67f652325e 100644
--- a/activesupport/test/abstract_unit.rb
+++ b/activesupport/test/abstract_unit.rb
@@ -1,10 +1,17 @@
-require File.expand_path('../../../load_paths', __FILE__)
+begin
+ old, $VERBOSE = $VERBOSE, nil
+ require File.expand_path('../../../load_paths', __FILE__)
+ensure
+ $VERBOSE = old
+end
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
require 'test/unit'
-require 'mocha'
+require 'active_support/core_ext/kernel/reporting'
+
+silence_warnings { require 'mocha' }
ENV['NO_RELOAD'] = '1'
require 'active_support'
diff --git a/activesupport/test/callback_inheritance_test.rb b/activesupport/test/callback_inheritance_test.rb
index e74c64ba8d..8caf000c5d 100644
--- a/activesupport/test/callback_inheritance_test.rb
+++ b/activesupport/test/callback_inheritance_test.rb
@@ -1,3 +1,4 @@
+require 'abstract_unit'
require 'test/unit'
require 'active_support'
diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb
index 3fb940ad3c..49d9de63b0 100644
--- a/activesupport/test/callbacks_test.rb
+++ b/activesupport/test/callbacks_test.rb
@@ -1,4 +1,4 @@
-# require 'abstract_unit'
+require 'abstract_unit'
require 'test/unit'
require 'active_support'
diff --git a/activesupport/test/core_ext/class/delegating_attributes_test.rb b/activesupport/test/core_ext/class/delegating_attributes_test.rb
index 636edb8d4b..6d6cb61571 100644
--- a/activesupport/test/core_ext/class/delegating_attributes_test.rb
+++ b/activesupport/test/core_ext/class/delegating_attributes_test.rb
@@ -11,6 +11,13 @@ module DelegatingFixtures
class Mokopuna < Child
end
+
+ class PercysMom
+ superclass_delegating_accessor :superpower
+ end
+
+ class Percy < PercysMom
+ end
end
class DelegatingAttributesTest < Test::Unit::TestCase
@@ -70,18 +77,17 @@ class DelegatingAttributesTest < Test::Unit::TestCase
end
def test_delegation_stops_at_the_right_level
- assert_nil Mokopuna.some_attribute
- assert_nil Child.some_attribute
- Child.some_attribute="1"
- assert_equal "1", Mokopuna.some_attribute
- ensure
- Child.some_attribute=nil
+ assert_nil Percy.superpower
+ assert_nil PercysMom.superpower
+
+ PercysMom.superpower = :heatvision
+ assert_equal :heatvision, Percy.superpower
end
-
+
def test_delegation_stops_for_nil
Mokopuna.some_attribute = nil
Child.some_attribute="1"
-
+
assert_equal "1", Child.some_attribute
assert_nil Mokopuna.some_attribute
ensure
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index 5b1d53ac7b..86272a28c1 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -757,6 +757,7 @@ class HashToXmlTest < Test::Unit::TestCase
<expires-at type="dateTime">2007-12-25T12:34:56+0000</expires-at>
<notes type="string"></notes>
<illustration type="base64Binary">YmFiZS5wbmc=</illustration>
+ <caption type="binary" encoding="base64">VGhhdCdsbCBkbywgcGlnLg==</caption>
</bacon>
EOT
@@ -766,7 +767,8 @@ class HashToXmlTest < Test::Unit::TestCase
:price => BigDecimal("12.50"),
:expires_at => Time.utc(2007,12,25,12,34,56),
:notes => "",
- :illustration => "babe.png"
+ :illustration => "babe.png",
+ :caption => "That'll do, pig."
}.stringify_keys
assert_equal expected_bacon_hash, Hash.from_xml(bacon_xml)["bacon"]
diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb
index 9edd7cc7c0..1712b0649b 100644
--- a/activesupport/test/core_ext/module_test.rb
+++ b/activesupport/test/core_ext/module_test.rb
@@ -141,6 +141,20 @@ class ModuleTest < Test::Unit::TestCase
assert_equal 0.0, nil_project.to_f
end
+ def test_delegation_does_not_raise_error_when_removing_singleton_instance_methods
+ parent = Class.new do
+ def self.parent_method; end
+ end
+
+ assert_nothing_raised do
+ child = Class.new(parent) do
+ class << self
+ delegate :parent_method, :to => :superclass
+ end
+ end
+ end
+ end
+
def test_parent
assert_equal Yz::Zy, Yz::Zy::Cd.parent
assert_equal Yz, Yz::Zy.parent
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index a50e259726..234e41c772 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -285,7 +285,7 @@ class TestGetTextString < Test::Unit::TestCase
def test_percent
assert_equal("% 1", "%% %<num>d" % {:num => 1.0})
- assert_equal("%{num} %<num>d", "%%{num} %%<num>d" % {:num => 1})
+ assert_equal("%{num} %<num>d 1", "%%{num} %%<num>d %<num>d" % {:num => 1})
end
def test_sprintf_percent_in_replacement
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index 6ff6dfb607..2cbf9e5042 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -88,7 +88,7 @@ class DependenciesTest < Test::Unit::TestCase
old_warnings, ActiveSupport::Dependencies.warnings_on_first_load = ActiveSupport::Dependencies.warnings_on_first_load, true
filename = "check_warnings"
- expanded = File.expand_path("test/dependencies/#{filename}")
+ expanded = File.expand_path("#{File.dirname(__FILE__)}/dependencies/#{filename}")
$check_warnings_load_count = 0
assert !ActiveSupport::Dependencies.loaded.include?(expanded)
diff --git a/activesupport/test/flush_cache_on_private_memoization_test.rb b/activesupport/test/flush_cache_on_private_memoization_test.rb
index 1cd313ec81..91b856ed7c 100644
--- a/activesupport/test/flush_cache_on_private_memoization_test.rb
+++ b/activesupport/test/flush_cache_on_private_memoization_test.rb
@@ -1,3 +1,4 @@
+require 'abstract_unit'
require 'active_support'
require 'test/unit'
diff --git a/activesupport/test/inflector_test_cases.rb b/activesupport/test/inflector_test_cases.rb
index ebd26d3fc6..56372903f3 100644
--- a/activesupport/test/inflector_test_cases.rb
+++ b/activesupport/test/inflector_test_cases.rb
@@ -180,18 +180,10 @@ module InflectorTestCases
"Test with + sign" => "test_with_sign"
}
- # Ruby 1.9 doesn't do Unicode normalization yet.
- if RUBY_VERSION >= '1.9'
- StringToParameterizedAndNormalized = {
- "Malmö" => "malm",
- "Garçons" => "gar-ons"
- }
- else
- StringToParameterizedAndNormalized = {
- "Malmö" => "malmo",
- "Garçons" => "garcons"
- }
- end
+ StringToParameterizedAndNormalized = {
+ "Malmö" => "malmo",
+ "Garçons" => "garcons"
+ }
UnderscoreToHuman = {
"employee_salary" => "Employee salary",
diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb
index 67c3527e23..92fbe5b92f 100644
--- a/activesupport/test/notifications_test.rb
+++ b/activesupport/test/notifications_test.rb
@@ -65,7 +65,7 @@ module Notifications
assert_equal [[:foo]] * 4, @events
end
- def test_log_subscriber_with_pattern
+ def test_log_subscriber_with_string
events = []
@notifier.subscribe('1') { |*args| events << args }
@@ -74,10 +74,10 @@ module Notifications
@notifier.publish 'a.1'
@notifier.wait
- assert_equal [['1'], ['1.a']], events
+ assert_equal [['1']], events
end
- def test_log_subscriber_with_pattern_as_regexp
+ def test_log_subscriber_with_pattern
events = []
@notifier.subscribe(/\d/) { |*args| events << args }
diff --git a/activesupport/test/ts_isolated.rb b/activesupport/test/ts_isolated.rb
index cbab61a523..58710e0165 100644
--- a/activesupport/test/ts_isolated.rb
+++ b/activesupport/test/ts_isolated.rb
@@ -1,3 +1,5 @@
+$:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
+
require 'test/unit'
require 'rbconfig'
require 'active_support/core_ext/kernel/reporting'