Class: Evilution::Integration::TestUnit Private
- Defined in:
- lib/evilution/integration/test_unit.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Test::Unit integration. Decomposed under lib/evilution/integration/test_unit/
mirroring the RSpec integration's layout. This class is the orchestrator:
it wires the framework loader, dispatcher, subject-class registry,
test-file resolver, and result builder. The class is registered under
Evilution::Runner::INTEGRATIONS and reachable via the
--integration test-unit CLI flag.
Defined Under Namespace
Modules: Dispatcher, ResultBuilder, SubjectClassRegistry Classes: FrameworkLoader, TestFileResolver
Class Method Summary collapse
- .baseline_options ⇒ Object private
- .baseline_runner ⇒ Object private
- .baseline_test_files(test_file) ⇒ Object private
- .run_baseline_test_file(test_file) ⇒ Object private
-
.spec_resolver ⇒ Object
private
SpecResolver tuned for the dominant Test::Unit layout: tests live under test/, named with the _test.rb suffix (the same convention Minitest uses).
Instance Method Summary collapse
-
#initialize(test_files: nil, hooks: nil, fallback_to_full_suite: false, spec_selector: nil) ⇒ TestUnit
constructor
private
A new instance of TestUnit.
Methods inherited from Base
Constructor Details
#initialize(test_files: nil, hooks: nil, fallback_to_full_suite: false, spec_selector: nil) ⇒ TestUnit
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.
Returns a new instance of TestUnit.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/evilution/integration/test_unit.rb', line 56 def initialize(test_files: nil, hooks: nil, fallback_to_full_suite: false, spec_selector: nil) require_relative "test_unit/framework_loader" require_relative "test_unit/subject_class_registry" require_relative "test_unit/dispatcher" require_relative "test_unit/test_file_resolver" require_relative "test_unit/result_builder" @framework_loader = FrameworkLoader.new @file_resolver = TestFileResolver.new( test_files: test_files, spec_selector: spec_selector || Evilution::SpecSelector.new(spec_resolver: self.class.spec_resolver), fallback_to_full_suite: fallback_to_full_suite ) @crash_detector = nil super(hooks: hooks) end |
Class Method Details
.baseline_options ⇒ Object
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.
31 32 33 34 35 36 37 |
# File 'lib/evilution/integration/test_unit.rb', line 31 def self. { runner: baseline_runner, spec_resolver: spec_resolver, fallback_dir: "test" } end |
.baseline_runner ⇒ Object
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.
18 19 20 |
# File 'lib/evilution/integration/test_unit.rb', line 18 def self.baseline_runner ->(test_file) { run_baseline_test_file(test_file) } end |
.baseline_test_files(test_file) ⇒ Object
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.
52 53 54 |
# File 'lib/evilution/integration/test_unit.rb', line 52 def self.baseline_test_files(test_file) File.directory?(test_file) ? Dir.glob(File.join(test_file, "**/*_test.rb")) : [test_file] end |
.run_baseline_test_file(test_file) ⇒ Object
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.
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/evilution/integration/test_unit.rb', line 39 def self.run_baseline_test_file(test_file) require_relative "test_unit/framework_loader" require_relative "test_unit/subject_class_registry" require_relative "test_unit/dispatcher" FrameworkLoader.new.call files = baseline_test_files(test_file) Evilution::Integration::Loading::TestLoadPath.add!(files) new_classes = SubjectClassRegistry.newly_loaded do files.each { |f| load(File.(f)) } end Dispatcher.call(new_classes, name: "evilution baseline").passed? end |
.spec_resolver ⇒ Object
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.
SpecResolver tuned for the dominant Test::Unit layout: tests live under
test/, named with the _test.rb suffix (the same convention Minitest uses).
Rails plugins on the test-unit gem (e.g. kaminari-core) follow this layout.
The test/test_
27 28 29 |
# File 'lib/evilution/integration/test_unit.rb', line 27 def self.spec_resolver Evilution::SpecResolver.new(test_dir: "test", test_suffix: "_test.rb", request_dir: "integration") end |