Class: Wukong::SpecHelpers::UnitTestRunner

Inherits:
Local::LocalRunner show all
Defined in:
lib/wukong/spec_helpers/unit_tests/unit_test_runner.rb

Overview

A class for controlling the Wukong boot sequence from within unit tests.

Subclasses the Wukong::Local::LocalRunner with which it shares most of its behavior:

  • Initialization is slightly different, to allow for each separate unit test in a suite to use a different Configliere::Param object for settings

  • The driver is the UnitTestDriver instead of the usual driver to allow for easily passing in records and getting them back out

  • The run method is a no-op so that control flow will exit out of the unit test back into the test suite

Instance Attribute Summary

Attributes inherited from Runner

#settings

Instance Method Summary collapse

Methods inherited from Local::LocalRunner

#setup, #validate

Methods included from Logging

included

Methods inherited from Runner

#args, #dataflow?, #dataflow_class_for, description, #description, die, #processor?, #program_name, #program_name=, #registered?, #root, run, usage, #usage

Methods included from Runner::BootSequence

#boot!

Methods included from Runner::HelpMessage

#dump_help, #dump_help_and_exit!, #help_given?, #strip_help_param!

Methods included from Runner::DeployPackLoader

#deploy_pack_dir, #environment_file, #in_deploy_pack?, #load_deploy_pack, #loaded_deploy_pack?

Constructor Details

#initialize(label, settings = {}) ⇒ UnitTestRunner

Initialize a new UnitTestRunner for the processor with the given label and settings.

Parameters:

  • label (Symbol)
  • settings (Hash) (defaults to: {})


27
28
29
30
31
32
# File 'lib/wukong/spec_helpers/unit_tests/unit_test_runner.rb', line 27

def initialize label, settings={}
  @dataflow = label
  params = Configliere::Param.new
  params.merge!(settings)
  super(params)
end

Instance Method Details

#dataflowObject



34
35
36
# File 'lib/wukong/spec_helpers/unit_tests/unit_test_runner.rb', line 34

def dataflow
  @dataflow
end

#driverUnitTestDriver

Override the LocalDriver with the UnitTestDriver so we can more easily pass in and retrieve processed records.

Returns:



42
43
44
# File 'lib/wukong/spec_helpers/unit_tests/unit_test_runner.rb', line 42

def driver
  @driver ||= UnitTestDriver.new(dataflow, settings)
end

#load_argsObject

No need to load commandline arguments when we are testing There are other mechanisms for passing them in, plus RSpec goes into an infinite loop if you load a spec file from within a spec file



50
51
# File 'lib/wukong/spec_helpers/unit_tests/unit_test_runner.rb', line 50

def load_args
end

#runObject

Do nothing. This prevents control flow within the Ruby interpreter from staying within this runner, as it would ordinarly do for wu-local.



56
57
# File 'lib/wukong/spec_helpers/unit_tests/unit_test_runner.rb', line 56

def run
end