Skip to content

Instantly share code, notes, and snippets.

@huguesbr
Last active July 1, 2019 15:17
Show Gist options
  • Save huguesbr/dc4ba10cdb47b4cf32ba2857a6ea0d87 to your computer and use it in GitHub Desktop.
Save huguesbr/dc4ba10cdb47b4cf32ba2857a6ea0d87 to your computer and use it in GitHub Desktop.
adding some rspec custom command
rspec-match() {
# rspec-match blah
# will run all specs matching blah
echo "running specs matching $1"
find spec -wholename "*$1*"| grep -v "factories"| xargs bin/rspec
}
rspec-branch() {
# will run all touches specs edited/created in current branch
current_branch_name=`git branch | grep \* | cut -d ' ' -f2`
echo "running specs since branched off ${1:-master}"
git diff --name-only ${1:-master} $current_branch_name | grep "^spec" | grep -v "^spec/factories"| xargs ls -d 2>/dev/null | xargs bin/rspec
}
rspec-failed() {
# run previously failed specs shortcuts
bin/rspec --only-failures
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment