Is there a way so that git refuses to commit to local or push to remote master if tests (rspec) are failing ? Thank you.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Use a git pre commit hook which executes rake spec
(taken from Tips for using a git pre-commit hook).
git stash -q --keep-index
`rake rspec`
RESULT=$?
git stash pop -q
[ $RESULT -ne 0 ] && exit 1
exit 0