Class | Spec::Runner::Formatter::ProfileFormatter
In: | lib/spec/runner/formatter/profile_formatter.rb
Parent: | ProgressBarFormatter

### Methods

example_passed example_started method_missing new start start_dump

### Public Class methods

new(options, where)

[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)

[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)

[Source]

        # File lib/spec/runner/formatter/profile_formatter.rb, line 17
    17:         def example_started(example)
    18:           @time = Time.now
    19:         end

method_missing(sym, *args)

[Source]

        # File lib/spec/runner/formatter/profile_formatter.rb, line 45
    45:         def method_missing(sym, *args)
    46:           # ignore
    47:         end

start(count)

[Source]

        # File lib/spec/runner/formatter/profile_formatter.rb, line 13
    13:         def start(count)
    14:           @output.puts "Profiling enabled."
    15:         end

start_dump()

[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

[Validate]