Module: Evilution::Integration::TestUnit::SubjectClassRegistry Private

Defined in:
lib/evilution/integration/test_unit/subject_class_registry.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Tracks Test::Unit::TestCase descendants in the host process. Test::Unit has no public registry-clear method analogous to Minitest::Runnable.runnables; the integration scopes each dispatch to classes that appeared during this round by diffing the descendant set before and after #load. Keeping that responsibility in its own object makes it cheap to stub in tests and lets the integration's main class read as orchestration.

Class Method Summary collapse

Class Method Details

.descendantsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
17
18
# File 'lib/evilution/integration/test_unit/subject_class_registry.rb', line 14

def descendants
  return [] unless defined?(::Test::Unit::TestCase)

  ObjectSpace.each_object(Class).select { |c| c < ::Test::Unit::TestCase }
end

.newly_loadedObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Yields, captures the descendant set before/after, and returns the diff.



21
22
23
24
25
# File 'lib/evilution/integration/test_unit/subject_class_registry.rb', line 21

def newly_loaded
  before = descendants
  yield
  descendants - before
end