Class: Rectory::CsvOutputter

Inherits:
Object
  • Object
show all
Defined in:
lib/rectory/csv_outputter.rb

Overview

Write the results of a test to a simple CSV file

Class Method Summary collapse

Class Method Details

.write(results, output, options = {}) ⇒ nil

Parameters:

  • results (Array)

    Rectory::Expectation set (with Rectory::Results)

  • output (String)

    path to the desired output CSV

  • options (Hash) (defaults to: {})

    options for CSV.open()

Returns:

  • (nil)


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rectory/csv_outputter.rb', line 10

def self.write(results, output, options = {})

  CSV.open(output, "wb", options) do |csv|
    csv << ["url","location","code","result_location","result_code","pass"]

    results.each do |r|
      csv << [r.url, r.location, r.code, r.result[:location], r.result[:code], r.pass?]
    end
  end

  nil
end