Class: CucumberStatistics::ScenarioStatistics
- Inherits:
-
Object
- Object
- CucumberStatistics::ScenarioStatistics
- Defined in:
- lib/cucumber_statistics/scenario_statistics.rb
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize ⇒ ScenarioStatistics
constructor
A new instance of ScenarioStatistics.
- #record(scenario_name, duration, file_colon_line) ⇒ Object
- #sort_by_property(property) ⇒ Object
Constructor Details
#initialize ⇒ ScenarioStatistics
Returns a new instance of ScenarioStatistics.
3 4 5 |
# File 'lib/cucumber_statistics/scenario_statistics.rb', line 3 def initialize @all = Hash.new end |
Instance Method Details
#all ⇒ Object
18 19 20 |
# File 'lib/cucumber_statistics/scenario_statistics.rb', line 18 def all @all end |
#record(scenario_name, duration, file_colon_line) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# 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) ⇒ Object
22 23 24 25 |
# 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 |