joequery
8/22/2012 - 12:42 PM

Ghetto Autotest

Ghetto Autotest

#!/bin/bash
# Our ghetto auto-testish thing. User presses any key to test,
# Ctrl-C to get out. Make this file executable, place in your path, and run in
# your Ruby project's directory. Assumes your tests are located in spec/
# Technically 100% more convenient than up+enter! ;)
 
function hold(){
    read -n 1 -s
}
 
function do_test(){
    printf "\nTesting..."
		# If no arguments passed, look for the spec directory
		# Otherwise, just run the tests where specified.
		if [ $# -gt 0 ]
		then
			bundle exec rspec -f nested --drb $@
		else
			find spec/* -name *.rb | xargs bundle exec rspec -f nested --drb
		fi
    printf "\nPress any key to test... \n"
    hold
    do_test $@
}
 
do_test $@