Skip to content

Instantly share code, notes, and snippets.

@chalmagean
Created July 8, 2015 15:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chalmagean/2b440f842270f3320ebb to your computer and use it in GitHub Desktop.
Save chalmagean/2b440f842270f3320ebb to your computer and use it in GitHub Desktop.
Pre-Push git hook to run specs before pushing
#!/bin/sh
# Put it in .git/hooks/pre-push
branch=`git rev-parse --abbrev-ref HEAD`
exit_code=$(bundle exec rspec --fail-fast --out /dev/null --format progress > /dev/null 2>/dev/null )$?
if [ $exit_code -gt 0 ]
then echo "Did not push because of failing tests"
fi
exit $exit_code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment