Class: Mutante::TestRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/mutante/test_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration, verbose: false) ⇒ TestRunner

Returns a new instance of TestRunner.



6
7
8
9
# File 'lib/mutante/test_runner.rb', line 6

def initialize(configuration, verbose: false)
  @configuration = configuration
  @verbose       = verbose
end

Instance Method Details

#call(spec_files = nil) ⇒ Object

Runs the configured test command, scoped to ‘spec_files` when provided (otherwise runs the whole suite). Returns true if the suite passed.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mutante/test_runner.rb', line 13

def call(spec_files = nil)
  command = build_command(spec_files)

  if @verbose
    puts "  $ #{command}"
    system(command, chdir: @configuration.root)
  else
    _out, _err, status = Open3.capture3(command, chdir: @configuration.root)
    status.success?
  end
end