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/jspec/jspec_parser.rb', line 3
def parse_result(detail)
summary_line = detail.grep( /Passes:/ )[0]
if summary_line.nil?
error_info = (detail + "\nUnknown Error!").to_a[0]
return :error, 'Error', error_info
end
summary_line = remove_colour(summary_line).strip
if summary_line =~ /Failures:\s+([1-9]+)\d*/
num_failures = $1
error_line = detail.grep(/\[31m/)[1] || ''
error_info = remove_colour(error_line).strip
return :failure, num_failures + ' Failures', error_info
end
return :success, 'All Passed', summary_line
end
|