diff options
author | Pablo Ifran <pabloifran@gmail.com> | 2012-10-22 09:42:42 -0200 |
---|---|---|
committer | Pablo Ifran <pabloifran@gmail.com> | 2012-10-22 09:42:42 -0200 |
commit | e041a50f2917f82950f9e5666f966d8992afd45d (patch) | |
tree | 9f4d2e3aa88f28dba9d7a1d24d46977e0642a1eb /activesupport/test/descendants_tracker_test_cases.rb | |
parent | 3e6b2f5d38e0f31db3fb0fcd3bbab92666a0e3e2 (diff) | |
parent | ae27acb342c575ce19d5ad78cb13ba23f826fab1 (diff) | |
download | rails-e041a50f2917f82950f9e5666f966d8992afd45d.tar.gz rails-e041a50f2917f82950f9e5666f966d8992afd45d.tar.bz2 rails-e041a50f2917f82950f9e5666f966d8992afd45d.zip |
Merge branch 'master' of https://github.com/lifo/docrails
Conflicts:
activerecord/lib/active_record/callbacks.rb
Diffstat (limited to 'activesupport/test/descendants_tracker_test_cases.rb')
-rw-r--r-- | activesupport/test/descendants_tracker_test_cases.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/activesupport/test/descendants_tracker_test_cases.rb b/activesupport/test/descendants_tracker_test_cases.rb index 066ec8549b..69e046998e 100644 --- a/activesupport/test/descendants_tracker_test_cases.rb +++ b/activesupport/test/descendants_tracker_test_cases.rb @@ -1,3 +1,5 @@ +require 'set' + module DescendantsTrackerTestCases class Parent extend ActiveSupport::DescendantsTracker @@ -18,15 +20,15 @@ module DescendantsTrackerTestCases ALL = [Parent, Child1, Child2, Grandchild1, Grandchild2] def test_descendants - assert_equal [Child1, Grandchild1, Grandchild2, Child2], Parent.descendants - assert_equal [Grandchild1, Grandchild2], Child1.descendants - assert_equal [], Child2.descendants + assert_equal_sets [Child1, Grandchild1, Grandchild2, Child2], Parent.descendants + assert_equal_sets [Grandchild1, Grandchild2], Child1.descendants + assert_equal_sets [], Child2.descendants end def test_direct_descendants - assert_equal [Child1, Child2], Parent.direct_descendants - assert_equal [Grandchild1, Grandchild2], Child1.direct_descendants - assert_equal [], Child2.direct_descendants + assert_equal_sets [Child1, Child2], Parent.direct_descendants + assert_equal_sets [Grandchild1, Grandchild2], Child1.direct_descendants + assert_equal_sets [], Child2.direct_descendants end def test_clear @@ -40,6 +42,10 @@ module DescendantsTrackerTestCases protected + def assert_equal_sets(expected, actual) + assert_equal Set.new(expected), Set.new(actual) + end + def mark_as_autoloaded(*klasses) # If ActiveSupport::Dependencies is not loaded, forget about autoloading. # This allows using AS::DescendantsTracker without AS::Dependencies. @@ -56,4 +62,4 @@ module DescendantsTrackerTestCases ActiveSupport::Dependencies.autoloaded_constants = old_autoloaded if defined? ActiveSupport::Dependencies ActiveSupport::DescendantsTracker.class_eval("@@direct_descendants").replace(old_descendants) end -end
\ No newline at end of file +end |