class TestRunner::CLI

Attributes

options[R]

Public Class Methods

new(argv, stdout) click to toggle source
# File lib/test_runner/cli.rb, line 12
def initialize argv, stdout
  @argv   = argv
  @stdout = stdout
end
run(argv) click to toggle source
# File lib/test_runner/cli.rb, line 5
def self.run argv
  instance = new argv, $stdout
  instance.()
end

Public Instance Methods

build_logger() click to toggle source
# File lib/test_runner/cli.rb, line 31
def build_logger
  logger = Logger.new @stdout
  logger.level = options.log_level
  logger.progname = "test_runner"
  logger
end
call() click to toggle source
# File lib/test_runner/cli.rb, line 17
def call
  @options = ArgvParser.(@argv)
  setup_config
  Runner.(filter_files) or exit 1
end
filter_files() click to toggle source
# File lib/test_runner/cli.rb, line 38
def filter_files
  resolve_files.reject do |path|
    path.end_with? "init.rb"
  end
end
resolve_files() click to toggle source
# File lib/test_runner/cli.rb, line 44
def resolve_files
  options.paths.flat_map do |path|
    if path.end_with? ".rb"
      [path]
    else
      Dir[File.join path, "**/*.rb"]
    end
  end
end
setup_config() click to toggle source
# File lib/test_runner/cli.rb, line 23
def setup_config
  Config.child_count = options.child_count
  Config.fail_fast = options.fail_fast?
  Config.logger = build_logger
  Config.reverse_backtraces = options.reverse_backtraces?
  Config.trim_backtraces = options.trim_backtraces?
end