Skip to content

An improve version of Pre-commit hook for git to run RSpec tests prior to committing. If any fail then the commit fails.

Notifications You must be signed in to change notification settings

jags84/RSpec-Pre-commit-Git-Hook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

RSpec Git Pre-commit Hook

This is an improve version of the rspec-precommit from markhazlett

We add this features

  1. Show what specs are failing
  2. Add Color to the results
  3. Add Loading while waiting to finish the rspec
  4. Add RAILS_ENV=test to rspec command

ToDo

  1. Show pending specs

The scripts will invoke your rspec tests and not allow you to commit unless they are all passing/pending. If any failures occur then it will stop the commit from going through to allow you to fix your tests.

Install

  1. Copy the rspec-precommit file into your .git/hooks directory.
  2. Call the rspec-precommit from the pre-commit ruby .git/hooks/rspec-precommit (example in pre-commit file in repo)
  3. Add rspec_results.html to your .gitignore file

Usage

  1. Try to perform a git commit -m with a failing Rspect test.
  2. To skip validation use --no-verify

Troubleshoot

If the hook is not getting executed, call chmod +x .git/hooks/rspec-precommit to make it so!

About

An improve version of Pre-commit hook for git to run RSpec tests prior to committing. If any fail then the commit fails.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 98.3%
  • Shell 1.7%