/usr/lib/ruby/vendor_ruby/rspec/core/profiler.rb is in ruby-rspec-core 3.5.0c3e0m0s0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | module RSpec
module Core
# @private
class Profiler
NOTIFICATIONS = [:example_group_started, :example_group_finished, :example_started]
def initialize
@example_groups = Hash.new { |h, k| h[k] = { :count => 0 } }
end
attr_reader :example_groups
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
def example_group_finished(notification)
return unless notification.group.top_level?
@example_groups[notification.group][:total_time] = Time.now - @example_groups[notification.group][:start]
end
def example_started(notification)
group = notification.example.example_group.parent_groups.last
@example_groups[group][:count] += 1
end
end
end
end
|