Sha256: ed09ccad1f13503999795fdae45e26ee1a74df13526670a3df9ba144e5312c5f

Contents?: true

Size: 1002 Bytes

Versions: 6891

Compression:

Stored size: 1002 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?

        group = @example_groups[notification.group]
        return unless group.key?(:start)
        group[:total_time] = Time.now - 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

6,891 entries across 6,827 versions & 85 rubygems

Version Path
cybrid_api_id_ruby-0.122.67 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_bank_ruby-0.122.66 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_organization_ruby-0.122.66 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_id_ruby-0.122.66 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_id_ruby-0.122.65 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_bank_ruby-0.122.65 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_organization_ruby-0.122.65 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_bank_ruby-0.122.64 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_id_ruby-0.122.64 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_organization_ruby-0.122.64 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_id_ruby-0.122.60 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_bank_ruby-0.122.60 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_organization_ruby-0.122.60 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_organization_ruby-0.122.59 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_bank_ruby-0.122.59 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_id_ruby-0.122.59 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_bank_ruby-0.122.58 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_organization_ruby-0.122.58 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_id_ruby-0.122.58 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb
cybrid_api_id_ruby-0.122.57 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/profiler.rb