class CucumberStatistics::ScenarioStatistics

Public Class Methods

new() click to toggle source
# File lib/cucumber_statistics/scenario_statistics.rb, line 3
def initialize
  @all = Hash.new
end

Public Instance Methods

all() click to toggle source
# File lib/cucumber_statistics/scenario_statistics.rb, line 18
def all
  @all
end
record(scenario_name, duration, file_colon_line) click to toggle source
# File lib/cucumber_statistics/scenario_statistics.rb, line 7
def record scenario_name, duration, file_colon_line
  short_file_colon_line = file_colon_line[file_colon_line.index('features').to_i..-1]

  scenario_result = @all[short_file_colon_line]
  scenario_result ||= Hash.new
  scenario_result[:duration] = duration
  scenario_result[:scenario_name] = scenario_name

  @all[short_file_colon_line] ||= scenario_result
end
sort_by_property(property) click to toggle source
# File lib/cucumber_statistics/scenario_statistics.rb, line 22
def sort_by_property property
  result = @all.sort {|a,b| a.last[property.to_sym] <=> b.last[property.to_sym]}
  result
end