Class: Evilution::Integration::TestUnit::TestFileResolver
- Inherits:
-
Object
- Object
- Evilution::Integration::TestUnit::TestFileResolver
- Defined in:
- lib/evilution/integration/test_unit/test_file_resolver.rb
Overview
Resolves the list of test files to load for a given mutation. Encapsulates the explicit-override path, spec-selector lookup, fallback glob, and the warn-once behaviour for unresolved sources. The integration class would otherwise carry both per-instance test resolution state (@test_files, @spec_selector, @warned_files, @fallback_to_full_suite) and dispatch orchestration in the same object; splitting them gives the resolver its own change axis (e.g. adding new resolution heuristics) independent of the runner.
Instance Method Summary collapse
-
#call(mutation_file_path) ⇒ Object
Returns the resolved file list, or nil if the source could not be resolved and fallback is disabled.
-
#initialize(test_files:, spec_selector:, fallback_to_full_suite:) ⇒ TestFileResolver
constructor
A new instance of TestFileResolver.
Constructor Details
#initialize(test_files:, spec_selector:, fallback_to_full_suite:) ⇒ TestFileResolver
Returns a new instance of TestFileResolver.
14 15 16 17 18 19 |
# File 'lib/evilution/integration/test_unit/test_file_resolver.rb', line 14 def initialize(test_files:, spec_selector:, fallback_to_full_suite:) @test_files = test_files @spec_selector = spec_selector @fallback_to_full_suite = fallback_to_full_suite @warned_files = Set.new end |
Instance Method Details
#call(mutation_file_path) ⇒ Object
Returns the resolved file list, or nil if the source could not be resolved and fallback is disabled.
23 24 25 26 27 28 29 30 31 |
# File 'lib/evilution/integration/test_unit/test_file_resolver.rb', line 23 def call(mutation_file_path) return @test_files if @test_files resolved = Array(@spec_selector.call(mutation_file_path)) return resolved unless resolved.empty? warn_unresolved(mutation_file_path) @fallback_to_full_suite ? glob_test_files : nil end |