Factoring sorted run into 'rake recspec'
This commit is contained in:
parent
e59cd57ebf
commit
7449821657
|
@ -11,12 +11,7 @@ module ::Guard
|
|||
def run_on_changes(paths)
|
||||
paths.delete('some_lib')
|
||||
if paths.size.zero?
|
||||
all = Dir['spec/**/*_spec.rb'].sort_by{|path| File.mtime(path)}.reverse
|
||||
warn <<-EOT
|
||||
No deduced mapping.
|
||||
Running all, sorting by mtime: #{all[0..2].join(' ')} ...etc.
|
||||
EOT
|
||||
system "rake spec run=#{all.join(',')}" or return
|
||||
system 'rake recspec'
|
||||
else
|
||||
paths.each do |path|
|
||||
system "rake spec run=#{path}" or return
|
||||
|
|
26
Rakefile
26
Rakefile
|
@ -45,20 +45,38 @@ end
|
|||
desc "Set up and run tests"
|
||||
task :default => [:test]
|
||||
|
||||
unless [].respond_to? :shuffle!
|
||||
class Array
|
||||
def shuffle!
|
||||
# TODO: fill this in if anyone cares
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def run_specs paths
|
||||
exec "bacon -Ispec -rubygems -q #{paths.join ' '}"
|
||||
end
|
||||
|
||||
desc "Run tests"
|
||||
task :test do
|
||||
check_dependencies unless ENV['SKIP_DEP_CHECK']
|
||||
all_specs =
|
||||
paths =
|
||||
if explicit_list = ENV['run']
|
||||
explicit_list.split(',')
|
||||
else
|
||||
Dir['spec/**/*_spec.rb']
|
||||
Dir['spec/**/*_spec.rb'].shuffle!
|
||||
end
|
||||
all_specs.shuffle! if all_specs.respond_to? :shuffle!
|
||||
exec "bacon -Ispec -rubygems -q #{all_specs.join ' '}"
|
||||
run_specs paths
|
||||
end
|
||||
task :spec => :test
|
||||
|
||||
task :recspec do
|
||||
all = Dir['spec/**/*_spec.rb'].sort_by{|path| File.mtime(path)}.reverse
|
||||
warn "Running all, sorting by mtime: #{all[0..2].join(' ')} ...etc."
|
||||
run_specs all
|
||||
end
|
||||
|
||||
desc "Run pry"
|
||||
task :pry do
|
||||
check_dependencies unless ENV['SKIP_DEP_CHECK']
|
||||
|
|
Loading…
Reference in New Issue