Sha256: 7d71c34adb42516967592b1e3b8efe1a085dd17624a3b1a6c11768c186696e4a

Contents?: true

Size: 508 Bytes

Versions: 2

Compression:

Stored size: 508 Bytes

Contents

module Minitest
  class StatsReporter < AbstractReporter
    def initialize _options
      @results = []
    end

    def start
      @current_time = Time.now
    end

    def record result
      @results << result
    end

    def report
      slowest = @results.sort_by(&:time).reverse.first(10)
      slowest.each do |result|
        puts "%10.4f %s" % [result.time, result.location]
      end
    end
  end

  def self.plugin_stats_init(options)
    self.reporter << StatsReporter.new(options)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gir_ffi-0.7.7 test/minitest/stats_plugin.rb
gir_ffi-0.7.6 test/minitest/stats_plugin.rb