From c53423fe821bde91d1f189bebf4bc2bba141f0e4 Mon Sep 17 00:00:00 2001 From: Jared White Date: Sat, 16 Mar 2024 12:27:37 -0700 Subject: [PATCH] test: fix occasional failure case --- .../lib/bridgetown-core/utils/loaders_manager.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb b/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb index f20bc3671..161feb4e1 100644 --- a/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb +++ b/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb @@ -39,9 +39,11 @@ def clear_descendants_for_reload(_cpath, value, _abspath) end # TODO: this could probably be refactored to work like the above - ActiveSupport::DescendantsTracker.class_variable_get( - :@@direct_descendants - )[value.superclass]&.reject! { _1 == value } + if ActiveSupport::DescendantsTracker.class_variables.include?(:@@direct_descendants) + ActiveSupport::DescendantsTracker.class_variable_get( + :@@direct_descendants + )[value.superclass]&.reject! { _1 == value } + end end def setup_loaders(autoload_paths = []) # rubocop:todo Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity