Class Index [+]

Quicksearch

Spec::Runner::Formatter::ProfileFormatter

Public Class Methods

new(options, where) click to toggle source
    # File lib/spec/runner/formatter/profile_formatter.rb, line 8
 8:         def initialize(options, where)
 9:           super
10:           @example_times = []
11:         end

Public Instance Methods

example_passed(example) click to toggle source
    # File lib/spec/runner/formatter/profile_formatter.rb, line 21
21:         def example_passed(example)
22:           super
23:           @example_times << [
24:             example_group.description,
25:             example.description,
26:             Time.now - @time
27:           ]
28:         end
example_started(example) click to toggle source
    # File lib/spec/runner/formatter/profile_formatter.rb, line 17
17:         def example_started(example)
18:           @time = Time.now
19:         end
start(count) click to toggle source
    # File lib/spec/runner/formatter/profile_formatter.rb, line 13
13:         def start(count)
14:           @output.puts "Profiling enabled."
15:         end
start_dump() click to toggle source
    # File lib/spec/runner/formatter/profile_formatter.rb, line 30
30:         def start_dump
31:           super
32:           @output.puts "\n\nTop 10 slowest examples:\n"
33:           
34:           @example_times = @example_times.sort_by do |description, example, time|
35:             time
36:           end.reverse
37:           
38:           @example_times[0..9].each do |description, example, time|
39:             @output.print red(sprintf("%.7f", time))
40:             @output.puts " #{description} #{example}"
41:           end
42:           @output.flush
43:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.