Class: AIRefactor::TestRunners::SteepRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/ai_refactor/test_runners/steep_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_path, command_template: "bundle exec steep __FILE__") ⇒ SteepRunner

Returns a new instance of SteepRunner.



8
9
10
11
# File 'lib/ai_refactor/test_runners/steep_runner.rb', line 8

def initialize(file_path, command_template: "bundle exec steep __FILE__")
  @file_path = file_path
  @command_template = command_template
end

Instance Method Details

#commandObject



13
14
15
# File 'lib/ai_refactor/test_runners/steep_runner.rb', line 13

def command
  @command_template.gsub("__FILE__", @file_path)
end

#runObject



17
18
19
20
21
22
23
24
# File 'lib/ai_refactor/test_runners/steep_runner.rb', line 17

def run
  stdout, stderr, status = Open3.capture3(command)
  # TODO: parse output
  # look initally for Cannot find a configuration at Steepfile
  #
  # _matched, runs, _assertions, failures, errors, skips = stdout.match(/(\d+) runs, (\d+) assertions, (\d+) failures, (\d+) errors, (\d+) skips/).to_a
  TestRunResult.new(stdout, stderr, status) # , runs, failures, skips, errors)
end