Class: Evilution::Integration::TestUnit::FrameworkLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/integration/test_unit/framework_loader.rb

Overview

Loads the test-unit gem and disables its at_exit auto-run handler. Mirrors Evilution::Integration::RSpec::FrameworkLoader’s role: framework setup is one responsibility separated from dispatch + result building so integrations can compose it independently in tests.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.stub_autorun!Object

User code that ‘require “test-unit”` installs an at_exit hook that calls Test::Unit::AutoRunner.run when need_auto_run? is true. At evilution exit ARGV still holds evilution flags and the runner prints a misleading banner. Flipping need_auto_run = false prevents the handler from firing.



28
29
30
31
32
# File 'lib/evilution/integration/test_unit/framework_loader.rb', line 28

def self.stub_autorun!
  return unless defined?(::Test::Unit::AutoRunner)

  ::Test::Unit::AutoRunner.need_auto_run = false
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
# File 'lib/evilution/integration/test_unit/framework_loader.rb', line 14

def call
  return if @loaded

  require "test-unit"
  self.class.stub_autorun!
  @loaded = true
rescue LoadError => e
  raise Evilution::Error, "test-unit is required but not available: #{e.message}"
end

#loaded?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/evilution/integration/test_unit/framework_loader.rb', line 10

def loaded?
  @loaded == true
end