2016-08-06 12:03:25 -04:00
|
|
|
require "abstract_unit"
|
|
|
|
require "active_support/descendants_tracker"
|
|
|
|
require "descendants_tracker_test_cases"
|
2011-03-13 11:52:34 -04:00
|
|
|
|
2012-01-05 20:12:46 -05:00
|
|
|
class DescendantsTrackerWithoutAutoloadingTest < ActiveSupport::TestCase
|
2011-03-13 11:52:34 -04:00
|
|
|
include DescendantsTrackerTestCases
|
2012-12-09 17:56:10 -05:00
|
|
|
|
2013-10-24 18:14:30 -04:00
|
|
|
# Regression test for #8422. https://github.com/rails/rails/issues/8442
|
2012-12-09 17:56:10 -05:00
|
|
|
def test_clear_without_autoloaded_singleton_parent
|
|
|
|
mark_as_autoloaded do
|
|
|
|
parent_instance = Parent.new
|
2013-10-24 18:14:30 -04:00
|
|
|
parent_instance.singleton_class.descendants
|
|
|
|
ActiveSupport::DescendantsTracker.clear
|
|
|
|
assert !ActiveSupport::DescendantsTracker.class_variable_get(:@@direct_descendants).key?(parent_instance.singleton_class)
|
2012-12-09 17:56:10 -05:00
|
|
|
end
|
|
|
|
end
|
2012-01-06 17:42:53 -05:00
|
|
|
end
|