diff options
author | José Valim <jose.valim@gmail.com> | 2010-06-19 16:58:12 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-19 16:58:15 +0200 |
commit | a2b7fcb07ca47ca2285dee2afe97050532e94d07 (patch) | |
tree | 238b4e7c1e8a247495d34bc147a9cfb9e702996e /activesupport/test | |
parent | 8db8c6f4ce3e8dd7f90553ab7866bf9991773b98 (diff) | |
download | rails-a2b7fcb07ca47ca2285dee2afe97050532e94d07.tar.gz rails-a2b7fcb07ca47ca2285dee2afe97050532e94d07.tar.bz2 rails-a2b7fcb07ca47ca2285dee2afe97050532e94d07.zip |
Change callbacks to automatically include DescendantsTracker and rename descendents to descendants.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/descendants_tracker_test.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activesupport/test/descendants_tracker_test.rb b/activesupport/test/descendants_tracker_test.rb index 57c97b45d2..e3eccb8aa9 100644 --- a/activesupport/test/descendants_tracker_test.rb +++ b/activesupport/test/descendants_tracker_test.rb @@ -1,6 +1,7 @@ require 'abstract_unit' require 'test/unit' require 'active_support' +require 'active_support/core_ext/hash/slice' class DescendantsTrackerTest < Test::Unit::TestCase class Parent @@ -19,6 +20,8 @@ class DescendantsTrackerTest < Test::Unit::TestCase class Grandchild2 < Child1 end + ALL = [Parent, Child1, Child2, Grandchild1, Grandchild2] + def test_descendants assert_equal [Child1, Grandchild1, Grandchild2, Child2], Parent.descendants assert_equal [Grandchild1, Grandchild2], Child1.descendants @@ -32,9 +35,9 @@ class DescendantsTrackerTest < Test::Unit::TestCase end def test_clear_with_autoloaded_parent_children_and_granchildren - mark_as_autoloaded Parent, Child1, Child2, Grandchild1, Grandchild2 do + mark_as_autoloaded *ALL do ActiveSupport::DescendantsTracker.clear - assert_equal Hash.new, ActiveSupport::DescendantsTracker.descendants + assert ActiveSupport::DescendantsTracker.descendants.slice(*ALL).empty? end end |