Class: JasmineNodeParser
- Inherits:
-
Object
- Object
- JasmineNodeParser
- Defined in:
- lib/tasks/jasmine_node/jasmine_node_parser.rb
Instance Method Summary collapse
-
#initialize(dir) ⇒ JasmineNodeParser
constructor
A new instance of JasmineNodeParser.
- #parse_result(detail) ⇒ Object
Constructor Details
#initialize(dir) ⇒ JasmineNodeParser
Returns a new instance of JasmineNodeParser.
3 4 5 |
# File 'lib/tasks/jasmine_node/jasmine_node_parser.rb', line 3 def initialize(dir) @dir = dir end |
Instance Method Details
#parse_result(detail) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tasks/jasmine_node/jasmine_node_parser.rb', line 7 def parse_result(detail) summary_line = detail.grep( /\d+\s+tests?.*,\s+\d+\s+assertions?.*,\s+\d+\s+failures?.*/ )[0] if summary_line.nil? # error error_info = detail.grep(/Error: /)[0] || "Unknown Error!" return :error, 'Error', error_info.strip end if summary_line =~ /([1-9]+)\d*\s+failures?/ num_failures = $1 error_info = detail.grep(/Error: /)[0] || "Unknown Error!" return :failure, num_failures + ' Errors', error_info.strip end return :success, 'All tests passed', '' end |