Included Modules

Class Index [+]

Quicksearch

Cucumber::Formatter::Usage

Public Class Methods

new(step_mother, path_or_io, options) click to toggle source
    # File lib/cucumber/formatter/usage.rb, line 13
13:       def initialize(step_mother, path_or_io, options)
14:         @step_mother = step_mother
15:         @io = ensure_io(path_or_io, "usage")
16:         @options = options
17:         @stepdef_to_match = Hash.new{|h,stepdef_key| h[stepdef_key] = []}
18:       end

Public Instance Methods

add_unused_stepdefs() click to toggle source
     # File lib/cucumber/formatter/usage.rb, line 119
119:       def add_unused_stepdefs
120:         @step_mother.unmatched_step_definitions.each do |step_definition|
121:           stepdef_key = StepDefKey.new(step_definition.regexp_source, step_definition.file_colon_line)
122:           @stepdef_to_match[stepdef_key] = []
123:         end
124:       end
after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) click to toggle source
    # File lib/cucumber/formatter/usage.rb, line 29
29:       def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
30:         if step_match.name.nil? # nil if it's from a scenario outline
31:           stepdef_key = StepDefKey.new(step_match.step_definition.regexp_source, step_match.step_definition.file_colon_line)
32: 
33:           @stepdef_to_match[stepdef_key] << {
34:             :keyword => keyword, 
35:             :step_match => step_match, 
36:             :status => status, 
37:             :file_colon_line => @step.file_colon_line,
38:             :duration => @duration
39:           }
40:         end
41:         super
42:       end
aggregate_info() click to toggle source
     # File lib/cucumber/formatter/usage.rb, line 106
106:       def aggregate_info
107:         @stepdef_to_match.each do |key, steps|
108:           if steps.empty?
109:             key.status = :skipped
110:             key.mean_duration = 0
111:           else
112:             key.status = Ast::StepInvocation.worst_status(steps.map{|step| step[:status]})
113:             total_duration = steps.inject(0) {|sum, step| step[:duration] + sum}
114:             key.mean_duration = total_duration / steps.length
115:           end
116:         end
117:       end
before_step(step) click to toggle source
    # File lib/cucumber/formatter/usage.rb, line 20
20:       def before_step(step)
21:         @step = step
22:         @start_time = Time.now
23:       end
before_step_result(*args) click to toggle source
    # File lib/cucumber/formatter/usage.rb, line 25
25:       def before_step_result(*args)
26:         @duration = Time.now - @start_time
27:       end
max_length() click to toggle source
    # File lib/cucumber/formatter/usage.rb, line 92
92:       def max_length
93:         [max_stepdef_length, max_step_length].compact.max
94:       end
max_step_length() click to toggle source
     # File lib/cucumber/formatter/usage.rb, line 100
100:       def max_step_length
101:         @stepdef_to_match.values.to_a.flatten.map do |step|
102:           step[:keyword].unpack('U*').length + step[:step_match].format_args.unpack('U*').length
103:         end.max
104:       end
max_stepdef_length() click to toggle source
    # File lib/cucumber/formatter/usage.rb, line 96
96:       def max_stepdef_length
97:         @stepdef_to_match.keys.flatten.map{|key| key.regexp_source.unpack('U*').length}.max
98:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.