Class: Sasspectations::ResultParser
- Inherits:
-
Object
- Object
- Sasspectations::ResultParser
- Defined in:
- lib/sasspectations/result_parser.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(css_output) ⇒ ResultParser
constructor
Assumes one spec result per line.
- #parse ⇒ Object
Constructor Details
#initialize(css_output) ⇒ ResultParser
Assumes one spec result per line
9 10 11 |
# File 'lib/sasspectations/result_parser.rb', line 9 def initialize(css_output) @css_output = css_output end |
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
5 6 7 |
# File 'lib/sasspectations/result_parser.rb', line 5 def result @result end |
Instance Method Details
#failed? ⇒ Boolean
24 25 26 |
# File 'lib/sasspectations/result_parser.rb', line 24 def failed? @result.any? { |r| r.first =~ /f/i } end |
#parse ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sasspectations/result_parser.rb', line 13 def parse spec_lines = @css_output.split("\n").reject! &:empty? @result = spec_lines.map do |spec_line| if spec_line =~ /{\s*expect\s?:\s?true[;]?\s?}/ [".".colorize(:green), spec_line] else ["F".colorize(:red), spec_line] end end end |