Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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