Sha256: 89ce2d23c6c5ff1f77121e4507cb0a39a8ae69f2a6c82db34b6dad5b09e25cd6
Contents?: true
Size: 841 Bytes
Versions: 7
Compression:
Stored size: 841 Bytes
Contents
# frozen_string_literal: true require "open3" module AIRefactor module TestRunners class RSpecRunner def initialize(file_path, command_template: "bundle exec rspec __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, example_count, failure_count = stdout.match(/(\d+) examples?, (\d+) failures?/).to_a pending_count = stdout.match(/(\d+) pending/)&.values_at(1) || "0" errored = stdout.match(/, (\d+) errors? occurred outside of examples/)&.values_at(1) || "0" TestRunResult.new(stdout, stderr, status, example_count, failure_count, pending_count, errored) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems