class CiHelper::RspecResultParser::Parser
Attributes
console_output[R]
This class handle the the result page in the to see the result of test and failures
fail_examples[R]
This class handle the the result page in the to see the result of test and failures
result[R]
This class handle the the result page in the to see the result of test and failures
status[R]
This class handle the the result page in the to see the result of test and failures
Public Instance Methods
console_output=(output_string)
click to toggle source
# File lib/ci_helper/rspec_result_parser/parser.rb, line 8 def console_output=(output_string) @console_output = output_string.split("\n") formalize_output end
formalize_output()
click to toggle source
# File lib/ci_helper/rspec_result_parser/parser.rb, line 17 def formalize_output fail Exceptions::SettingError, 'Please set the console output first ' unless console_output start_index = nil fail_example_start_index = nil fail_example_end_index = nil result_index = false console_output.each_index do |index| if console_output[index].match('Finished in') start_index = index elsif console_output[index].match('Failed examples:') fail_example_start_index = index elsif console_output[index].match('Randomized') fail_example_end_index = index elsif console_output[index].match('Finished: ') result_index = index end end @status = console_output[start_index, start_index + 1] @fail_examples = console_output[fail_example_start_index..fail_example_end_index] if fail_example_start_index @result = result_index end
success?()
click to toggle source
# File lib/ci_helper/rspec_result_parser/parser.rb, line 13 def success? status[0].match('success') ? true : false end