Class: RspecSprint::Normalizer::Snapshot
- Inherits:
-
Struct
- Object
- Struct
- RspecSprint::Normalizer::Snapshot
- Defined in:
- lib/rspec_sprint/normalizer.rb
Instance Attribute Summary collapse
-
#example_count ⇒ Object
Returns the value of attribute example_count.
-
#examples ⇒ Object
Returns the value of attribute examples.
-
#factories ⇒ Object
Returns the value of attribute factories.
-
#factory_time ⇒ Object
Returns the value of attribute factory_time.
-
#failure_count ⇒ Object
Returns the value of attribute failure_count.
-
#suite_duration ⇒ Object
Returns the value of attribute suite_duration.
Instance Method Summary collapse
-
#factory_time_ratio ⇒ Object
Share of example-run wall time spent building factories (top-level, so cascade time is not double-counted).
-
#path_group_durations ⇒ Object
run_time summed by the first path segment under spec/ (Rule② data).
- #slow_examples ⇒ Object
Instance Attribute Details
#example_count ⇒ Object
Returns the value of attribute example_count
23 24 25 |
# File 'lib/rspec_sprint/normalizer.rb', line 23 def example_count @example_count end |
#examples ⇒ Object
Returns the value of attribute examples
23 24 25 |
# File 'lib/rspec_sprint/normalizer.rb', line 23 def examples @examples end |
#factories ⇒ Object
Returns the value of attribute factories
23 24 25 |
# File 'lib/rspec_sprint/normalizer.rb', line 23 def factories @factories end |
#factory_time ⇒ Object
Returns the value of attribute factory_time
23 24 25 |
# File 'lib/rspec_sprint/normalizer.rb', line 23 def factory_time @factory_time end |
#failure_count ⇒ Object
Returns the value of attribute failure_count
23 24 25 |
# File 'lib/rspec_sprint/normalizer.rb', line 23 def failure_count @failure_count end |
#suite_duration ⇒ Object
Returns the value of attribute suite_duration
23 24 25 |
# File 'lib/rspec_sprint/normalizer.rb', line 23 def suite_duration @suite_duration end |
Instance Method Details
#factory_time_ratio ⇒ Object
Share of example-run wall time spent building factories (top-level, so cascade time is not double-counted). Denominator = summary.duration (D7).
30 31 32 33 34 |
# File 'lib/rspec_sprint/normalizer.rb', line 30 def factory_time_ratio return 0.0 if suite_duration.nil? || suite_duration.zero? factory_time / suite_duration end |
#path_group_durations ⇒ Object
run_time summed by the first path segment under spec/ (Rule② data). Deliberately “path group”, not RSpec metadata ‘type:` — see design D10⑦.
42 43 44 45 46 |
# File 'lib/rspec_sprint/normalizer.rb', line 42 def path_group_durations (examples || []).each_with_object(Hash.new(0.0)) do |ex, acc| acc[path_group(ex.file_path)] += ex.run_time end end |
#slow_examples ⇒ Object
36 37 38 |
# File 'lib/rspec_sprint/normalizer.rb', line 36 def slow_examples (examples || []).sort_by { |e| -e.run_time } end |