class CucumberOutputParser

Public Class Methods

parse_failed_features(cucumber_output) click to toggle source
# File lib/recumber/cucumber_output_parser.rb, line 3
def self.parse_failed_features(cucumber_output)
  file_list = remove_non_cucumber_lines(cucumber_output)
  file_list = remove_cucumber_commands(file_list)
  file_list = remove_comment_lines(file_list)
  file_list = collapse_newlines(file_list)

  if file_list.empty?
    file_list = cucumber_output.match(/features\/.*\.feature:\d/m)
    file_list = file_list[0].gsub(/\n/, " ")
    file_list = file_list.gsub(/\.\d+/, "")
  end

  file_list.split(" ")
end

Private Class Methods

collapse_newlines(lines) click to toggle source
# File lib/recumber/cucumber_output_parser.rb, line 32
def self.collapse_newlines(lines)
  lines.gsub(/\n/, "")
end
remove_comment_lines(lines) click to toggle source
# File lib/recumber/cucumber_output_parser.rb, line 28
def self.remove_comment_lines(lines)
  lines.gsub(/#.*/, "")
end
remove_cucumber_commands(lines) click to toggle source
# File lib/recumber/cucumber_output_parser.rb, line 24
def self.remove_cucumber_commands(lines)
  lines.gsub(/cucumber (-p parallel)?/, "")
end
remove_non_cucumber_lines(lines) click to toggle source
# File lib/recumber/cucumber_output_parser.rb, line 20
def self.remove_non_cucumber_lines(lines)
  lines.gsub(/^((?!cucumber).)*$/, "").strip
end