Created
June 25, 2009 04:22
-
-
Save davidlee/135680 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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