Skip to content

Instantly share code, notes, and snippets.

@garybernhardt
Created March 26, 2011 21:41
Show Gist options
  • Save garybernhardt/888666 to your computer and use it in GitHub Desktop.
Save garybernhardt/888666 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
if [ $# -gt 0 ]; then # we have args
filename=$1
(set +e; grep -r 'spec_helper' $filename) > /dev/null
if [ $? -eq 1 ]; then # no match; we have a stand-alone spec
standalone_spec=1
fi
else # we have no args
filename='spec'
fi
command='rspec'
if [ ! $standalone_spec ]; then
command="ruby -S bundle exec $command"
fi
RAILS_ENV=test $command $filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment