Last active
January 2, 2016 16:09
-
-
Save gtd/8328395 to your computer and use it in GitHub Desktop.
This file contains 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
function rt { | |
if [ $# -le 1 ] ; then | |
echo Running: ruby -Itest $1 | |
ruby -Itest $1 | |
else | |
p2=$2 | |
param=$p2[0,5] | |
if [ $param = 'test/' ] ; then # Assumes all test files are in test/** | |
while [ "$1" != "" ]; do | |
if [ ! $test_files ]; then | |
test_files=$1 | |
else | |
test_files="$test_files,$1" | |
fi | |
shift | |
done | |
echo Running: rake TEST_FILES=$test_files # Note this requires custom Rakefile http://stackoverflow.com/questions/6656935/how-to-run-multiple-rails-unit-tests-at-once | |
rake TEST_FILES=$test_files | |
else | |
regex=/$argv[2,-1]/ | |
echo "Running: ruby -Itest $1 '$regex'" | |
ruby -Itest $1 -n $regex | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment