Skip to content

Instantly share code, notes, and snippets.

@davetapley
Created January 23, 2015 18:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davetapley/c5a9ba3c0222ada8de01 to your computer and use it in GitHub Desktop.
Save davetapley/c5a9ba3c0222ada8de01 to your computer and use it in GitHub Desktop.
Pending failing rspec tests
#!/usr/bin/ruby
require 'pty'
cmd = ARGV.first
begin
PTY.spawn( cmd ) do |stdin, stdout, pid|
begin
stdin.each do |line|
line_no_color = line.gsub(/\e\[(\d+)(;\d+)*m/, '')
match = /.*rspec ([^ ]*):([^ ]*) .*/.match(line_no_color)
next unless match
file_name, line_num = match.captures
`sed -i '#{ line_num }s/it /pending /' #{ file_name }`
end
rescue Errno::EIO
puts 'done'
end
end
rescue PTY::ChildExited
puts "The child process exited!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment