Last Updated: February 25, 2016
·
2.376K
· lukaszkorecki

Runs rspec tests in subdirectories

You can pass an optional filter to filter out directories in which you don't want to run tests

#!/usr/bin/env zsh
source "$HOME/.rvm/scripts/rvm" 2>&1 >/dev/null
o=$(pwd)
filter=$1
if [[ -z $filter ]]; then
  filter=""
fi

for d in $(find . -name spec -type d | egrep "$filter" | replace spec ' ' )
do
  cd $d 2>/dev/null
  echo "$d  -------------------------------"
  git status -s -b
  RACK_ENV=test bundle exec rspec -f n -c 2>/dev/null | egrep " examples.*failu"
  echo "\n"
  cd $o
done