Skip to content

Instantly share code, notes, and snippets.

@nickhoffman
Created August 27, 2011 19:21
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 nickhoffman/1175763 to your computer and use it in GitHub Desktop.
Save nickhoffman/1175763 to your computer and use it in GitHub Desktop.
A rake task for running all of the spec files that've been modified.
RSpec::Core::RakeTask.new('spec:changed') do |t|
changed_files = `git status -s | grep '^ M spec/' | grep '_spec.rb$'`.split "\n"
changed_files.each {|file| file.sub! /\A M /, '' }
puts
puts "Found #{changed_files.count} changed spec file(s):"
changed_files.each {|file| puts " #{file}"}
puts
t.pattern = changed_files
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment