aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/descendants_tracker_with_autoloading_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-07 12:26:45 +0200
committerJosé Valim <jose.valim@gmail.com>2011-05-07 12:26:45 +0200
commitb011a7a938b7289b7d08042474ff4bee07efb7fe (patch)
tree14e47474a91385dfe591265a8d978eeb19540479 /activesupport/test/descendants_tracker_with_autoloading_test.rb
parenta761d77902cccdace9482d690a70a358a651337e (diff)
parent512057d386075f207d8927a5e0ce3943174d5c78 (diff)
downloadrails-b011a7a938b7289b7d08042474ff4bee07efb7fe.tar.gz
rails-b011a7a938b7289b7d08042474ff4bee07efb7fe.tar.bz2
rails-b011a7a938b7289b7d08042474ff4bee07efb7fe.zip
Merge remote branch 'rolftimmermans/desc_tracker'
Diffstat (limited to 'activesupport/test/descendants_tracker_with_autoloading_test.rb')
-rw-r--r--activesupport/test/descendants_tracker_with_autoloading_test.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/activesupport/test/descendants_tracker_with_autoloading_test.rb b/activesupport/test/descendants_tracker_with_autoloading_test.rb
new file mode 100644
index 0000000000..ae18a56f44
--- /dev/null
+++ b/activesupport/test/descendants_tracker_with_autoloading_test.rb
@@ -0,0 +1,35 @@
+require 'abstract_unit'
+require 'test/unit'
+require 'active_support/descendants_tracker'
+require 'active_support/dependencies'
+require 'descendants_tracker_test_cases'
+
+class DescendantsTrackerWithAutoloadingTest < Test::Unit::TestCase
+ include DescendantsTrackerTestCases
+
+ def test_clear_with_autoloaded_parent_children_and_granchildren
+ mark_as_autoloaded(*ALL) do
+ ActiveSupport::DescendantsTracker.clear
+ ALL.each do |k|
+ assert ActiveSupport::DescendantsTracker.descendants(k).empty?
+ end
+ end
+ end
+
+ def test_clear_with_autoloaded_children_and_granchildren
+ mark_as_autoloaded Child1, Grandchild1, Grandchild2 do
+ ActiveSupport::DescendantsTracker.clear
+ assert_equal [Child2], Parent.descendants
+ assert_equal [], Child2.descendants
+ end
+ end
+
+ def test_clear_with_autoloaded_granchildren
+ mark_as_autoloaded Grandchild1, Grandchild2 do
+ ActiveSupport::DescendantsTracker.clear
+ assert_equal [Child1, Child2], Parent.descendants
+ assert_equal [], Child1.descendants
+ assert_equal [], Child2.descendants
+ end
+ end
+end \ No newline at end of file