Class: TestProf::TPSProf::RSpecListener
- Inherits:
-
Object
- Object
- TestProf::TPSProf::RSpecListener
- Includes:
- Logging
- Defined in:
- lib/test_prof/tps_prof/rspec.rb
Overview
:nodoc:
Constant Summary collapse
- NOTIFICATIONS =
%i[ example_group_started example_group_finished example_started example_finished ].freeze
Constants included from Logging
Instance Attribute Summary collapse
-
#profiler ⇒ Object
readonly
Returns the value of attribute profiler.
-
#reporter ⇒ Object
readonly
Returns the value of attribute reporter.
Instance Method Summary collapse
- #example_finished(notification) ⇒ Object
- #example_group_finished(notification) ⇒ Object
- #example_group_started(notification) ⇒ Object
- #example_started(notification) ⇒ Object
-
#initialize ⇒ RSpecListener
constructor
A new instance of RSpecListener.
- #print ⇒ Object
Methods included from Logging
Constructor Details
#initialize ⇒ RSpecListener
Returns a new instance of RSpecListener.
17 18 19 20 21 22 |
# File 'lib/test_prof/tps_prof/rspec.rb', line 17 def initialize @profiler = Profiler.new(TPSProf.config.top_count, threshold: TPSProf.config.threshold) @reporter = TPSProf.config.reporter log :info, "TPSProf enabled (top-#{TPSProf.config.top_count})" end |
Instance Attribute Details
#profiler ⇒ Object (readonly)
Returns the value of attribute profiler.
15 16 17 |
# File 'lib/test_prof/tps_prof/rspec.rb', line 15 def profiler @profiler end |
#reporter ⇒ Object (readonly)
Returns the value of attribute reporter.
15 16 17 |
# File 'lib/test_prof/tps_prof/rspec.rb', line 15 def reporter @reporter end |
Instance Method Details
#example_finished(notification) ⇒ Object
38 39 40 |
# File 'lib/test_prof/tps_prof/rspec.rb', line 38 def example_finished(notification) profiler.example_finished notification.example end |
#example_group_finished(notification) ⇒ Object
29 30 31 32 |
# File 'lib/test_prof/tps_prof/rspec.rb', line 29 def example_group_finished(notification) return unless notification.group.top_level? profiler.group_finished notification.group end |
#example_group_started(notification) ⇒ Object
24 25 26 27 |
# File 'lib/test_prof/tps_prof/rspec.rb', line 24 def example_group_started(notification) return unless notification.group.top_level? profiler.group_started notification.group end |
#example_started(notification) ⇒ Object
34 35 36 |
# File 'lib/test_prof/tps_prof/rspec.rb', line 34 def example_started(notification) profiler.example_started notification.example end |
#print ⇒ Object
42 43 44 |
# File 'lib/test_prof/tps_prof/rspec.rb', line 42 def print reporter.print(profiler) end |