Skip to content

Instantly share code, notes, and snippets.

@alexbartlow
Created April 4, 2014 17:13
Show Gist options
  • Save alexbartlow/9978917 to your computer and use it in GitHub Desktop.
Save alexbartlow/9978917 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
specs_to_run = `git status --porcelain | grep "spec"`.each_line.map{|line| line.split(/\s+/).last}
specs_to_run.reject!{|spec| spec =~ %r{^spec/support} }
puts "running #{specs_to_run.join(',')}"
`git add spec && git stash save --keep-index`
puts `rspec #{specs_to_run.join(' ')} 2> /dev/null`
`git stash pop`
puts `rspec #{specs_to_run.join(' ')} 2> /dev/null`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment