Sha256: f61663ee7f4663aea090e47399876b13b0a37e11fb21222e5e26ff18aa25611b

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 Bytes

Contents

module ProcessHelpers
  def successful_process_status
    process_status_double(true)
  end

  def failed_process_status
    process_status_double(false)
  end

  def process_status_double(success_boolean)
    instance_double(Process::Status).tap do |status|
      allow(status).to receive(:success?).and_return success_boolean
    end
  end

  def which_success(command)
    # The kind of response that Open3 will return if `which command` was successful
    ["/usr/local/bin/#{command}\n", successful_process_status]
  end

  def which_failure
    # The kind of response that Open3 will return if `which command` failed
    ["", failed_process_status]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pluginscan-0.9.0 spec/support/process_helpers.rb