Skip to content

Instantly share code, notes, and snippets.

@gtd
Last active January 2, 2016 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gtd/8328395 to your computer and use it in GitHub Desktop.
Save gtd/8328395 to your computer and use it in GitHub Desktop.
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