Class: JasmineCIParser

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/jasmine_ci/jasmine_ci_parser.rb

Instance Method Summary collapse

Instance Method Details

#parse_result(detail) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tasks/jasmine_ci/jasmine_ci_parser.rb', line 3

def parse_result(detail)
  summary_line = detail.grep( /\d+ examples?, \d+ failures?/ )[0]

  if summary_line.nil?
    # error
    error_info = (detail + "\nUnknown Error!").to_a[0].strip
    return :error, 'Error', error_info
  end

  if summary_line =~ /([1-9]+) failures?/
    num_errors = $1

    error_info = 'Unknown error'
    if detail =~ /1\) (.*?)[\n]{2}/m
      error_info = $1
    end
    return :failure, num_errors + ' Errors', error_info
  end

  return :success, 'All specs pass', ''

end