Skip to content

Instantly share code, notes, and snippets.

@davidlee
Created June 25, 2009 04:22
Show Gist options
  • Save davidlee/135680 to your computer and use it in GitHub Desktop.
Save davidlee/135680 to your computer and use it in GitHub Desktop.
namespace :spec do
def find_last_modified_spec
require 'find'
specs = []
Find.find( File.expand_path(File.join(RAILS_ROOT,'spec'))) do |f|
next unless f =~ /_spec.rb$/
specs << f
end
spec = specs.sort_by { |spec| File.stat( spec ).mtime }.last
end
desc "runs the last modified spec, without mucking about"
Spec::Rake::SpecTask.new(:last) do |t|
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
t.spec_files = FileList[find_last_modified_spec]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment