Skip to content

Instantly share code, notes, and snippets.

@angelbotto
Created September 12, 2015 22:32
Show Gist options
  • Save angelbotto/bb60401b03a0f349b693 to your computer and use it in GitHub Desktop.
Save angelbotto/bb60401b03a0f349b693 to your computer and use it in GitHub Desktop.
Run all test before commits :)
#!/bin/bash
git stash -q --keep-index
echo -e "👮 Wait, run all test before commit!\n"
FAILS=`rspec --format progress | grep -E '(\d*) failure(s?)' -o | awk '{print $1}'`
git stash pop -q
if [ $FAILS -ne 0 ]; then
echo -e "✋ Can't commit! You've broken $FAILS tests!!!"
exit 1
else
echo -e "👍 Commit approved.\n"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment