Skip to content

Instantly share code, notes, and snippets.

@kukat
Last active June 29, 2016 03:15
Show Gist options
  • Save kukat/f3fcd2a0bc0a216169f489aeead4eb1c to your computer and use it in GitHub Desktop.
Save kukat/f3fcd2a0bc0a216169f489aeead4eb1c to your computer and use it in GitHub Desktop.
#!/bin/sh
files=$(git diff HEAD --name-only --diff-filter=ACMR -- apps/realestate/test/**Spec.swift)
pass=true
fits=""
if [ "$files" != "" ]; then
echo "Checking 'fit', 'fcontext' and 'fdescribe' in unit tests..."
echo ""
for file in ${files}; do
fits=$(grep -nE '^\s*f(it|context|describe)' ${file})
if [ "$fits" != "" ]; then
echo "${file}"
echo "${fits}"
echo ""
pass=false
fi
done
fi
if $pass; then
exit 0;
else
echo "----------------------------------------------"
echo "COMMIT FAILED:"
echo "You cannot commit test cases with temporary focused examples 'fit', 'fcontext' and 'fdescribe'."
exit 1;
fi
@kukat
Copy link
Author

kukat commented Jun 29, 2016

今天写测试被fit坑了一把,什么是 fit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment