Last active
December 14, 2015 16:48
-
-
Save timoschilling/5117201 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Lives in .git/hooks. | |
# To enable this hook, rename this file to "pre-commit". | |
# Redirect output to stderr. | |
exec 1>&2 | |
# works, but is slow. try with ack! | |
# LANG=C find . -name '*_spec.rb' | xargs egrep -q '^\s*(describe|it|context)\b.*focus' | |
# much faster, but not as portable | |
ack -G '_spec.rb' '^\s*(describe|it|context|should)\b.*focus' | |
if [ $? -eq 0 ] | |
then | |
echo "Error: attempted to check in an rspec *_spec.rb file which contains a focus." | |
echo "Do \"find . -name '*_spec.rb' | xargs egrep '^\s*(describe|it|context)\b.*focus'\" to find out." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment