Class: RSpec::Core::Profiler
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/profiler.rb
Constant Summary collapse
- NOTIFICATIONS =
[:example_group_started, :example_group_finished, :example_started]
Instance Attribute Summary collapse
-
#example_groups ⇒ Object
readonly
Returns the value of attribute example_groups.
Instance Method Summary collapse
- #example_group_finished(notification) ⇒ Object
- #example_group_started(notification) ⇒ Object
- #example_started(notification) ⇒ Object
-
#initialize ⇒ Profiler
constructor
A new instance of Profiler.
Constructor Details
Instance Attribute Details
#example_groups ⇒ Object (readonly)
Returns the value of attribute example_groups.
11 12 13 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/profiler.rb', line 11 def example_groups @example_groups end |
Instance Method Details
#example_group_finished(notification) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/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) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/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) ⇒ Object
28 29 30 31 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/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 |