I am using Guard with Rspec; I use focus: true to force it run only tests I am working on. But sometimes I forget to remove focu
A good source of information is the book at git-scm.
You want the pre-commit hook. To return a non-zero value (and thus abort the commit), you'd want something along these lines:
FILES_PATTERN='\.rb(\..+)?$'
FORBIDDEN='focus: true'
git diff --cached --name-only | \
grep -spec/ | \
grep -E $FILES_PATTERN | \
xargs grep --with-filename -n $FORBIDDEN && echo "COMMIT REJECTED Found '$FORBIDDEN' references. Please remove them before commiting" && exit 1
That's lifted from this rather good tips site. I haven't tested the tweaks I made.