Class: TestProf::StackProf::Listener

Inherits:
Object
  • Object
show all
Defined in:
lib/test_prof/stack_prof/rspec.rb

Overview

Reporter for RSpec to profile specific examples with StackProf

Constant Summary collapse

NOTIFICATIONS =

:nodoc:

i[
  example_started
  example_finished
].freeze

Instance Method Summary collapse

Instance Method Details

#example_finished(notification) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/test_prof/stack_prof/rspec.rb', line 17

def example_finished(notification)
  return unless profile?(notification.example)
  return unless notification.example.[:sprof_report] == false

  TestProf::StackProf.dump(
    notification.example.full_description.parameterize
  )
end

#example_started(notification) ⇒ Object



12
13
14
15
# File 'lib/test_prof/stack_prof/rspec.rb', line 12

def example_started(notification)
  return unless profile?(notification.example)
  notification.example.[:sprof_report] = TestProf::StackProf.profile
end