class RSpec::Core::Profiler

@private

Constants

NOTIFICATIONS

Attributes

example_groups[R]

Public Class Methods

new() click to toggle source
# File lib/rspec/core/profiler.rb, line 7
def initialize
  @example_groups = Hash.new { |h, k| h[k] = { :count => 0 } }
end

Public Instance Methods

example_group_finished(notification) click to toggle source
# File lib/rspec/core/profiler.rb, line 20
def example_group_finished(notification)
  return unless notification.group.top_level?

  group = @example_groups[notification.group]
  return unless group.key?(:start)
  group[:total_time] = Time.now - group[:start]
end
example_group_started(notification) click to toggle source
# File lib/rspec/core/profiler.rb, line 13
def example_group_started(notification)
  return unless notification.group.top_level?

  @example_groups[notification.group][:start] = Time.now
  @example_groups[notification.group][:description] = notification.group.top_level_description
end
example_started(notification) click to toggle source
# File lib/rspec/core/profiler.rb, line 28
def example_started(notification)
  group = notification.example.example_group.parent_groups.last
  @example_groups[group][:count] += 1
end