class Cucumber::Core::Test::Result::Summary
An object that responds to the description protocol from the results
and collects summary information. e.g. summary = Result::Summary.new Result::Passed.new(0).describe_to(summary) puts summary.total_passed => 1
Attributes
durations[R]
exceptions[R]
Public Class Methods
new()
click to toggle source
# File lib/cucumber/core/test/result.rb, line 205 def initialize @totals = Hash.new { 0 } @exceptions = [] @durations = [] end
Public Instance Methods
duration(duration)
click to toggle source
# File lib/cucumber/core/test/result.rb, line 224 def duration(duration) @durations << duration self end
exception(exception)
click to toggle source
# File lib/cucumber/core/test/result.rb, line 219 def exception(exception) @exceptions << exception self end
method_missing(name, *args)
click to toggle source
# File lib/cucumber/core/test/result.rb, line 211 def method_missing(name, *args) if name =~ /^total_/ get_total(name) else increment_total(name) end end
total()
click to toggle source
# File lib/cucumber/core/test/result.rb, line 229 def total @totals.reduce(0) { |total, status| total += status[1] } end
Private Instance Methods
get_total(method_name)
click to toggle source
# File lib/cucumber/core/test/result.rb, line 235 def get_total(method_name) status = method_name.to_s.gsub('total_', '').to_sym return @totals.fetch(status) { 0 } end
increment_total(status)
click to toggle source
# File lib/cucumber/core/test/result.rb, line 240 def increment_total(status) @totals[status] += 1 self end