if !defined? RSpec say "RSpec was not installed. Adding it now..." gem "rspec-rails" , group: [:development, :test] run "bundle install" generate "rspec:install" end gem "factory_bot_rails", group: [:development, :test] run "bundle install" create_file "spec/support/factory_bot.rb", <<~EOF RSpec.configure do |config| config.include FactoryBot::Syntax::Methods end EOF gsub_file 'spec/rails_helper.rb', "# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }\n", "Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }\n"