Skip to content

Instantly share code, notes, and snippets.

@taketo1113
Last active February 4, 2021 03:07
Show Gist options
  • Save taketo1113/e05ad8488096cde709554aa9d30cf44a to your computer and use it in GitHub Desktop.
Save taketo1113/e05ad8488096cde709554aa9d30cf44a to your computer and use it in GitHub Desktop.
Replace 'factory_girl' to 'factory_bot'

Replace 'factory_girl' to 'factory_bot'

  • edit Gemfile
gem 'factory_bot_rails'
  • gem install
$ bundle install
  • replace Class
$ grep -rl FactoryGirl ./spec/* | xargs sed -i '' "s/FactoryGirl/FactoryBot/g"

or (on ubuntu 16.04)

$ grep -rl FactoryGirl ./spec/* | xargs sed -i'' "s/FactoryGirl/FactoryBot/g"
  • test
$ bundle exec rails spec

Upgrade from factory_girl | GitHub

@madwort
Copy link

madwort commented Apr 4, 2018

I needed xargs sed -i '' "s/FactoryGirl/FactoryBot/g" to be xargs sed -i'' "s/FactoryGirl/FactoryBot/g" on ubuntu 16.04

@taketo1113
Copy link
Author

@madwort Thank you for comment.
Added sample to replace class for ubuntu 16.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment