Sha256: a4978a9b5c7d896e54a28f29bc376496c1687a329758bd1b20369933cc37d206

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Rspeckled
module Reporting
module Outputs
class  Text
  FIELDS = {
    :branch             => '%-<branch>s',
    :commit_hash        => '%-8.8<commit_hash>s',
    :date               => '%-<date>s',
    :file               => '%-80.80<file>s',
    :status             => '%-7.7<status>s',
    :time               => '%7.4<time>f',
    :query_count        => '%3<query_count>d',
    :query_time         => '%7.4<query_time>f',
    :query_percentage   => '%5.2<query_percentage>f%%',
    :request_count      => '%3<request_count>d',
    :request_time       => '%7.4<request_time>f',
    :request_percentage => '%5.2<request_percentage>f%%',
    :description        => '%-80.80<description>s',
  }.freeze

  attr_accessor :output

  def initialize
    self.output = File.open('log/rspec_report.txt', 'a')
  end

  def insert(data)
    data[:file] = data[:file].gsub(%r{^\./spec/}, './') + ':' + data[:line_number].to_s

    format_string = FIELDS.values.join(' - ') + "\n"

    output.printf(format_string, data)
  end
end
end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspeckled-0.0.43 lib/rspeckled/reporting/outputs/text.rb