Sha256: 6c0412c5642331d0448daa1aec1b69526d1f9969921ebded8f6ed3f50fcf1cde

Contents?: true

Size: 1.09 KB

Versions: 38

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'fileutils'

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
    FileUtils.mkdir_p('log')

    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

38 entries across 38 versions & 1 rubygems

Version Path
rspeckled-2.0.1 lib/rspeckled/reporting/outputs/text.rb
rspeckled-2.0.0 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.4.0 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.3.1 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.3.0 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.2.1 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.2.0 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.1.3 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.1.2 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.1.1 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.1.0 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.0.5 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.0.4 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.0.3 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.0.2 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.0.1 lib/rspeckled/reporting/outputs/text.rb
rspeckled-1.0.0 lib/rspeckled/reporting/outputs/text.rb
rspeckled-0.0.64 lib/rspeckled/reporting/outputs/text.rb
rspeckled-0.0.63 lib/rspeckled/reporting/outputs/text.rb
rspeckled-0.0.62 lib/rspeckled/reporting/outputs/text.rb