Skip to content

Instantly share code, notes, and snippets.

@odlp
Created June 9, 2017 11:35
Show Gist options
  • Save odlp/9e55c57d8f9321c738732b40987a4aa0 to your computer and use it in GitHub Desktop.
Save odlp/9e55c57d8f9321c738732b40987a4aa0 to your computer and use it in GitHub Desktop.
No focus specs
#!/bin/sh
set -eu
failIfPresentInSpecs() {
REGEX=$1
if find spec -type f -name "*_spec.rb" -exec grep -E "$REGEX" {} +; then
printf "\nFound focused specs\n"
exit 1
fi
}
failIfPresentInSpecs "(:focus\s=>|focus:)\strue"
failIfPresentInSpecs "(fit|fdescribe|fcontext)\s?(\(|\"|')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment