class Quality::Process

Wrapper around IO.popen that allows exit status to be mocked in tests.

Public Class Methods

new(full_cmd, dependencies = {}) click to toggle source
# File lib/quality/process.rb, line 8
def initialize(full_cmd,
               dependencies = {})
  @full_cmd = full_cmd
  @popener = dependencies[:popener] || IO
end

Public Instance Methods

run() { |file| ... } click to toggle source
# File lib/quality/process.rb, line 14
def run
  @popener.popen(@full_cmd) do |file|
    yield file
  end
  $CHILD_STATUS&.exitstatus
end