Skip to content

Instantly share code, notes, and snippets.

@threedaymonk
Created March 29, 2016 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save threedaymonk/2ecbae0a632c90ed02e7 to your computer and use it in GitHub Desktop.
Save threedaymonk/2ecbae0a632c90ed02e7 to your computer and use it in GitHub Desktop.
Annotate failing Cucumber scenarios with @broken
failures = {}
ARGF.read.split(/\n/).each do |line|
matches = line.match(/\Acucumber ([^:]+):(\d+)/) or next
(failures[matches[1]] ||= []) << matches[2].to_i - 1
end
failures.each do |file, indices|
lines = File.readlines(file)
indices.reverse.each do |index|
indentation = lines[index][/\A\s+/]
lines = lines.take(index) + ["#{indentation}@broken\n"] + lines.drop(index)
end
File.open(file, 'w') do |io|
io << lines.join('')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment