diff options
author | José Valim <jose.valim@gmail.com> | 2010-06-19 17:16:11 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-19 17:16:11 +0200 |
commit | d430db9fd407fd6aee25ca13538d8988dc7ee297 (patch) | |
tree | 3ee11ca65b495d3c427e40b9a41d532689979727 | |
parent | 033e0a041f10ef4d4aa8ebb576560df20b971026 (diff) | |
download | rails-d430db9fd407fd6aee25ca13538d8988dc7ee297.tar.gz rails-d430db9fd407fd6aee25ca13538d8988dc7ee297.tar.bz2 rails-d430db9fd407fd6aee25ca13538d8988dc7ee297.zip |
Remove descendants warning while executing tests.
-rw-r--r-- | activesupport/lib/active_support/descendants_tracker.rb | 5 | ||||
-rw-r--r-- | activesupport/test/descendants_tracker_test.rb | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/descendants_tracker.rb b/activesupport/lib/active_support/descendants_tracker.rb index a9379bf95b..a587d7770c 100644 --- a/activesupport/lib/active_support/descendants_tracker.rb +++ b/activesupport/lib/active_support/descendants_tracker.rb @@ -4,9 +4,12 @@ module ActiveSupport # This module provides an internal implementation to track descendants # which is faster than iterating through ObjectSpace. module DescendantsTracker - mattr_accessor :descendants @@descendants = Hash.new { |h, k| h[k] = [] } + def self.descendants + @@descendants + end + def self.clear @@descendants.each do |klass, descendants| if ActiveSupport::Dependencies.autoloaded?(klass) diff --git a/activesupport/test/descendants_tracker_test.rb b/activesupport/test/descendants_tracker_test.rb index e3eccb8aa9..3a424180de 100644 --- a/activesupport/test/descendants_tracker_test.rb +++ b/activesupport/test/descendants_tracker_test.rb @@ -70,6 +70,6 @@ class DescendantsTrackerTest < Test::Unit::TestCase yield ensure ActiveSupport::Dependencies.autoloaded_constants = old_autoloaded - ActiveSupport::DescendantsTracker.descendants = old_descendants + ActiveSupport::DescendantsTracker.descendants.replace(old_descendants) end end
\ No newline at end of file |