Skip to content

Instantly share code, notes, and snippets.

@huguesbr

huguesbr/.bash_profile

Last active Jul 1, 2019
Embed
What would you like to do?
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