Sha256: 3293a1e234f29abc6333c68be6e4cdd9ca57589dc4ccae510d3d8062655cece4

Contents?: true

Size: 548 Bytes

Versions: 2

Compression:

Stored size: 548 Bytes

Contents

class Result
  attr_reader :identifier
  attr_accessor :example_count, :duration_raw

  def initialize(identifier)
    @identifier = identifier
    @example_count = 0
    @duration_raw = 0.0
  end

  def avg_duration_seconds
    format_seconds(duration_raw / example_count)
  end

  def duration_seconds
    format_seconds(duration_raw)
  end

  def to_a
    [identifier, example_count, duration_seconds, avg_duration_seconds]
  end

  private

  def format_seconds(duration)
    RSpec::Core::Formatters::Helpers.format_seconds(duration)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec_overview-0.3.0 lib/rspec_overview/result.rb
rspec_overview-0.2.0 lib/rspec_overview/result.rb