diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-10-24 20:14:30 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-10-24 20:14:30 -0200 |
commit | 24b690eae64e04c4f3566c52655e92d7a9521dca (patch) | |
tree | 06cf18dad4df05e09dd6a51e50e735ddecf7a754 | |
parent | 6ed5d515cf945c626fd27b68353d0d6402e37050 (diff) | |
download | rails-24b690eae64e04c4f3566c52655e92d7a9521dca.tar.gz rails-24b690eae64e04c4f3566c52655e92d7a9521dca.tar.bz2 rails-24b690eae64e04c4f3566c52655e92d7a9521dca.zip |
Improve the test code for #8422
* Remove unneeded comments.
* Use key? instead of keys.include?.
-rw-r--r-- | activesupport/test/descendants_tracker_without_autoloading_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activesupport/test/descendants_tracker_without_autoloading_test.rb b/activesupport/test/descendants_tracker_without_autoloading_test.rb index 4f1ee3e760..00b449af51 100644 --- a/activesupport/test/descendants_tracker_without_autoloading_test.rb +++ b/activesupport/test/descendants_tracker_without_autoloading_test.rb @@ -5,13 +5,13 @@ require 'descendants_tracker_test_cases' class DescendantsTrackerWithoutAutoloadingTest < ActiveSupport::TestCase include DescendantsTrackerTestCases + # Regression test for #8422. https://github.com/rails/rails/issues/8442 def test_clear_without_autoloaded_singleton_parent mark_as_autoloaded do parent_instance = Parent.new - parent_instance.singleton_class.descendants #adds singleton class in @@direct_descendants - ActiveSupport::DescendantsTracker.clear #clear is supposed to remove singleton class keys so GC can remove them. - assert !ActiveSupport::DescendantsTracker.class_variable_get(:@@direct_descendants).keys.include?(parent_instance.singleton_class) + parent_instance.singleton_class.descendants + ActiveSupport::DescendantsTracker.clear + assert !ActiveSupport::DescendantsTracker.class_variable_get(:@@direct_descendants).key?(parent_instance.singleton_class) end end - end |