Method: Wukong::SpecHelpers::UnitTests#runner
- Defined in:
- lib/wukong/spec_helpers/unit_tests.rb
#runner(klass, program_name, *args, &block) ⇒ Object
Create and boot up a runner of the given klass.
Options to the runner class are given in the args Array.
The last element of this Array can be a Hash of options to
directly pass to the runner (especially useful in unit tests).
The rest of the elements are strings that will be parsed as
though they were command-line arguments.
A passed block will be eval'd in the context of the newlyl created runner instance. This can be used to interact with the runner's insides after initialization.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/wukong/spec_helpers/unit_tests.rb', line 38 def runner klass, program_name, *args, &block settings = args. ARGV.replace(args.map(&:to_s)) klass.new.tap do |the_runner| the_runner.program_name = program_name the_runner.instance_eval(&block) if block_given? the_runner.boot!(settings) end end |