Created
July 20, 2011 17:19
-
-
Save kevn/1095399 to your computer and use it in GitHub Desktop.
Run all tests matching wildcard args
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
# Usage: run_tests user group network | |
pwd = Dir.pwd | |
finder_args = ARGV.map{|s| %Q(-name "*#{s}*_test.rb") }.join(' -or ') | |
test_paths = `find test -type d -maxdepth 1 -mindepth 1`.split("\n") | |
test_paths.each do |path| | |
tests = `find #{path} #{finder_args}`.split("\n") | |
if tests.any? | |
puts "=== #{path} ===" | |
rake_path = Gem.source_index.detect{|name, spec| name =~ /^rake-/ }[1].full_gem_path | |
cmd = %Q(ruby -I"lib:test" "#{rake_path}/lib/rake/rake_test_loader.rb" #{tests.join(' ')}) | |
puts cmd | |
system cmd | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment