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 206
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 225
def duration(duration)
  @durations << duration
  self
end
exception(exception) click to toggle source
# File lib/cucumber/core/test/result.rb, line 220
def exception(exception)
  @exceptions << exception
  self
end
method_missing(name, *args) click to toggle source
# File lib/cucumber/core/test/result.rb, line 212
def method_missing(name, *args)
  if name =~ /^total_/
    get_total(name)
  else
    increment_total(name)
  end
end
total(for_status = nil) click to toggle source
# File lib/cucumber/core/test/result.rb, line 230
def total(for_status = nil)
  if for_status
    @totals.fetch(for_status) { 0 }
  else
    @totals.reduce(0) { |total, status| total += status[1] }
  end
end

Private Instance Methods

get_total(method_name) click to toggle source
# File lib/cucumber/core/test/result.rb, line 240
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 245
def increment_total(status)
  @totals[status] += 1
  self
end