Sha256: e97522120cf8c091c3603d379a6f95bd124d1b16b83feeec3a604a06a8a0d193

Contents?: true

Size: 686 Bytes

Versions: 6

Compression:

Stored size: 686 Bytes

Contents

# frozen_string_literal: true

require "open3"

module AIRefactor
  module TestRunners
    class MinitestRunner
      def initialize(file_path, command_template: "ruby __FILE__")
        @file_path = file_path
        @command_template = command_template
      end

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

      def run
        stdout, stderr, status = Open3.capture3(command)
        _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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ai_refactor-0.6.0 lib/ai_refactor/test_runners/minitest_runner.rb
ai_refactor-0.5.4 lib/ai_refactor/test_runners/minitest_runner.rb
ai_refactor-0.5.3 lib/ai_refactor/test_runners/minitest_runner.rb
ai_refactor-0.5.2 lib/ai_refactor/test_runners/minitest_runner.rb
ai_refactor-0.5.1 lib/ai_refactor/test_runners/minitest_runner.rb
ai_refactor-0.5.0 lib/ai_refactor/test_runners/minitest_runner.rb