Sha256: 37b790d6818c94c77e699975a387f5eb1180723a62bfbb3658976e29e0446fa6

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require "abstract_unit"
require "active_support/descendants_tracker"
require "active_support/dependencies"
require "descendants_tracker_test_cases"

class DescendantsTrackerWithAutoloadingTest < ActiveSupport::TestCase
  include DescendantsTrackerTestCases

  def test_clear_with_autoloaded_parent_children_and_grandchildren
    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_grandchildren
    mark_as_autoloaded Child1, Grandchild1, Grandchild2 do
      ActiveSupport::DescendantsTracker.clear
      assert_equal_sets [Child2], Parent.descendants
      assert_equal_sets [], Child2.descendants
    end
  end

  def test_clear_with_autoloaded_grandchildren
    mark_as_autoloaded Grandchild1, Grandchild2 do
      ActiveSupport::DescendantsTracker.clear
      assert_equal_sets [Child1, Child2], Parent.descendants
      assert_equal_sets [], Child1.descendants
      assert_equal_sets [], Child2.descendants
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-on-quails-0.1.0 activesupport/test/descendants_tracker_with_autoloading_test.rb