Class: RSpec::TAP::Formatters::TestStats
- Inherits:
-
Object
- Object
- RSpec::TAP::Formatters::TestStats
- Defined in:
- lib/rspec/tap/formatters/test_stats.rb
Overview
Test stats calculator
Instance Attribute Summary collapse
-
#data ⇒ Hash<Integer, Array<Integer, 4>>
Example stats.
Instance Method Summary collapse
-
#increment(line_number, index)
private
Increments the stats for a line number and example status.
-
#initialize ⇒ TestStats
constructor
Constructor.
-
#populate(notification, index)
Populates total number of examples and one of passing, failing, and, pending example.
Constructor Details
#initialize ⇒ TestStats
Constructor
13 14 15 |
# File 'lib/rspec/tap/formatters/test_stats.rb', line 13 def initialize @data = {} end |
Instance Attribute Details
#data ⇒ Hash<Integer, Array<Integer, 4>>
Returns example stats.
10 11 12 |
# File 'lib/rspec/tap/formatters/test_stats.rb', line 10 def data @data end |
Instance Method Details
#increment(line_number, index) (private)
Increments the stats for a line number and example status.
42 43 44 45 46 |
# File 'lib/rspec/tap/formatters/test_stats.rb', line 42 def increment(line_number, index) @data[line_number] ||= [0, 0, 0, 0] @data[line_number][0] += 1 @data[line_number][index] += 1 end |
#populate(notification, index)
Populates total number of examples and one of passing, failing, and, pending example. Traverses bottom up to populate each of the parent example group stats.
25 26 27 28 29 30 31 32 33 |
# File 'lib/rspec/tap/formatters/test_stats.rb', line 25 def populate(notification, index) = notification.example.[:example_group] increment([:line_number], index) while ( = [:parent_example_group]) = increment([:line_number], index) end end |