Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored AS::DescendantsTracker test cases so they can be tested wi…
…thout AS::Dependencies.
- Loading branch information
Rolf Timmermans
committed
Mar 13, 2011
1 parent
56a0cba
commit 76e4e2f
Showing
3 changed files
with
52 additions
and
27 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
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 | Original file line | 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 | Original file line | 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 |