Class: TestOutputParser
- Inherits:
-
Object
- Object
- TestOutputParser
- Defined in:
- lib/test_output_parser.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input) ⇒ TestOutputParser
constructor
A new instance of TestOutputParser.
- #parse ⇒ Object
- #parse_error ⇒ Object
Constructor Details
#initialize(input) ⇒ TestOutputParser
12 13 14 |
# File 'lib/test_output_parser.rb', line 12 def initialize(input) @input = input end |
Class Method Details
.parse(input) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/test_output_parser.rb', line 2 def self.parse(input) parser = self.new(input) if input.match(/!/) parser.parse_error else parser.parse end end |
Instance Method Details
#parse ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/test_output_parser.rb', line 16 def parse output = "" output += dots_or_fs + "\n" if failures > 0 output += blank_lines(3) + "\n" output += failed_tests + "\n" end output += blank_lines(2) + "\n" output += "#{total} tests ran, #{failures} red, #{passed} green" + "\n" output += blank_lines(2) output end |
#parse_error ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/test_output_parser.rb', line 31 def parse_error [ "Unable to run tests, SML says:".red, "", "", @input, ].join("\n") end |