-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote branch 'rolftimmermans/desc_tracker'
- Loading branch information
Showing
7 changed files
with
64 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
activesupport/test/descendants_tracker_with_autoloading_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
8 changes: 8 additions & 0 deletions
8
activesupport/test/descendants_tracker_without_autoloading_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'abstract_unit' | ||
require 'test/unit' | ||
require 'active_support/descendants_tracker' | ||
require 'descendants_tracker_test_cases' | ||
|
||
class DescendantsTrackerWithoutAutoloadingTest < Test::Unit::TestCase | ||
include DescendantsTrackerTestCases | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters