Created
May 7, 2021 00:24
-
-
Save ggaona/0473c685bf03125e2b81d1720125de0a to your computer and use it in GitHub Desktop.
Minitest & Brakeman pre-push git hook
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/bash | |
# Execute tests (Minitest, Brakeman) before committing; aborts push if any | |
# test fails. | |
# By ggaona | |
# Execute brakeman | |
echo "[Brakeman]" | |
bundle exec brakeman --color | |
# Docker alternative | |
# docker exec <container_name> brakeman --color | |
# Abort push if failed tests are found | |
if [ $? -ne 0 ]; then | |
echo "Push aborted." | |
exit 1 | |
fi | |
# Execute minitest | |
echo "[Test Suite]" | |
bundle exec rails test -c | |
# Docker alternative | |
# docker exec <container_name> rails test -c | |
# Abort push if failed tests are found | |
if [ $? -ne 0 ]; then | |
echo "Push aborted." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment