Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# get a list of files which contain "require" AND "spec_helper" on a single line
# excluding spec/rails_helper.rb (we want "require 'spec_helper'" to exist here)
declare -a files=$(git grep -E "require.*spec_helper" | cut -d ':' -f 1 | grep -v 'spec/rails_helper.rb')
# loop through files and replace "spec_helper" with "rails_helper"
for i in $files; do
sed -i '' -e 's/spec_helper/rails_helper/' $i
done
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.