aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/descendants_tracker_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-06-19 16:58:12 +0200
committerJosé Valim <jose.valim@gmail.com>2010-06-19 16:58:15 +0200
commita2b7fcb07ca47ca2285dee2afe97050532e94d07 (patch)
tree238b4e7c1e8a247495d34bc147a9cfb9e702996e /activesupport/test/descendants_tracker_test.rb
parent8db8c6f4ce3e8dd7f90553ab7866bf9991773b98 (diff)
downloadrails-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/descendants_tracker_test.rb')
-rw-r--r--activesupport/test/descendants_tracker_test.rb7
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