Class: StartingBlocks::ResultParser

Inherits:
Object
  • Object
show all
Defined in:
lib/starting_blocks/result_parser.rb

Instance Method Summary collapse

Instance Method Details

#get_count_of(name, text) ⇒ Object



13
14
15
16
17
# File 'lib/starting_blocks/result_parser.rb', line 13

def get_count_of name, text
  text.scan(/(\d+ #{name})/)[-1][0].split(' ')[0].to_i
rescue
  0
end

#parse(text) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/starting_blocks/result_parser.rb', line 3

def parse(text)
  {
    tests: get_count_of('tests', text),
    assertions: get_count_of('assertions', text),
    failures: get_count_of('failures', text),
    errors: get_count_of('errors', text),
    skips: get_count_of('skips', text)
  }
end