Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
If you're using FactoryGirl, replace all occurrences of 'create' with 'build' and 'git add' the specs that still pass.
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"
echo "$spec passed!!!"
git add $spec

This comment has been minimized.

Copy link
Owner Author

travisofthenorth commented Jun 19, 2016

If you use parentheses, e.g. create(:thing), you can make the sed command a little more reliable by including a few extra characters:
find spec -iname "*spec.rb" -exec sed -i.bak 's/create(:/build(:/g' {} \;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.