Sha256: 9be0009a75d2a4b801871233edcd60387835345012f3c6159394d7a9947fd58f

Contents?: true

Size: 970 Bytes

Versions: 168

Compression:

Stored size: 970 Bytes

Contents

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

Version data entries

168 entries across 153 versions & 46 rubygems

Version Path
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/rspec-core-3.5.4/lib/rspec/core/profiler.rb