Last active
September 28, 2017 20:04
-
-
Save travisofthenorth/4c88c0e6db5db61153607d652237582c to your computer and use it in GitHub Desktop.
If you're using FactoryGirl, replace all occurrences of 'create' with 'build' and 'git add' the specs that still pass.
This file contains hidden or 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
#!/bin/bash | |
find spec -iname "*spec.rb" -exec sed -i.bak 's/create/build/g' {} \; | |
find spec -iname "*spec.rb" -print0 | while IFS= read -r -d $'\0' spec; do | |
spring rspec $spec --fail-fast | |
if [[ $? -gt 0 ]]; then | |
echo "$spec did not pass" | |
else | |
echo "$spec passed!!!" | |
git add $spec | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you use parentheses, e.g.
create(:thing)
, you can make thesed
command a little more reliable by including a few extra characters:find spec -iname "*spec.rb" -exec sed -i.bak 's/create(:/build(:/g' {} \;