Last active
October 28, 2020 17:06
-
-
Save r7kamura/a23efa7d14a2b7c56dfee0959b8ce859 to your computer and use it in GitHub Desktop.
Rename FactoryBot files from singular to plural.
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
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'activesupport' | |
end | |
require 'active_support/inflector' | |
require 'pathname' | |
Pathname.glob('spec/factories/**/*.rb').each do |pathname| | |
basename = pathname.basename('.rb').to_s.pluralize | |
pathname.rename("#{pathname.dirname}/#{basename}.rb") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment