Last active
July 1, 2019 15:17
-
-
Save huguesbr/dc4ba10cdb47b4cf32ba2857a6ea0d87 to your computer and use it in GitHub Desktop.
adding some rspec custom command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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