Skip to content

Instantly share code, notes, and snippets.

@aprescott
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aprescott/9353408 to your computer and use it in GitHub Desktop.
Save aprescott/9353408 to your computer and use it in GitHub Desktop.
# Collect _spec.rb and .feature files under spec/ that are relevant to current work, one per line. Good for pipes.
#
# 1. Modified, staged git files.
# 2. Modified, unstaged git files.
# 3. Changes in any commits since master.
# 4. New, untracked files.
#
# $ specs | xargs rspec
cat <(git diff --name-only) <(git diff --staged --name-only) <(git diff master..@ --name-only) <(git ls-files --others --exclude-standard) | uniq | grep -e "^spec/" | grep -E "_spec\.rb$|\.feature$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment