Skip to content

Instantly share code, notes, and snippets.

@joequery
Created August 22, 2012 12:42
Show Gist options
  • Select an option

  • Save joequery/3425222 to your computer and use it in GitHub Desktop.

Select an option

Save joequery/3425222 to your computer and use it in GitHub Desktop.
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 $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment