Skip to content

Instantly share code, notes, and snippets.

@benjaminoakes
Last active March 31, 2017 16:43
Show Gist options
  • Save benjaminoakes/3b631b67848f9f187269a5811ec930e8 to your computer and use it in GitHub Desktop.
Save benjaminoakes/3b631b67848f9f187269a5811ec930e8 to your computer and use it in GitHub Desktop.
Rails: Run Changed Tests
#!/bin/sh
extant_files=""
for file in $(git diff --name-only master . | grep '^test' | grep -v '^test/factories' | grep -v '^test/support'); do
if [ -f "$file" ]; then
extant_files="$extant_files $file"
fi
done
set -x
# Or whatever commmand you use to test, e.g. `ruby -I test path/to/test.rb`
zeus test $extant_files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment