Class: Suspenders::FactoriesGenerator

Inherits:
Generators::Base
  • Object
show all
Defined in:
lib/suspenders/generators/factories_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #replace_in_file

Instance Method Details

#add_factory_botObject



5
6
7
8
9
# File 'lib/suspenders/generators/factories_generator.rb', line 5

def add_factory_bot
  gem "factory_bot_rails", group: %i(development test)
  gem "database_cleaner", group: %i(development test), require: false
  Bundler.with_clean_env { run "bundle install" }
end

#provide_dev_prime_taskObject



19
20
21
# File 'lib/suspenders/generators/factories_generator.rb', line 19

def provide_dev_prime_task
  copy_file "dev.rake", "lib/tasks/dev.rake"
end

#set_up_factory_bot_for_rspecObject



11
12
13
# File 'lib/suspenders/generators/factories_generator.rb', line 11

def set_up_factory_bot_for_rspec
  copy_file "factory_bot_rspec.rb", "spec/support/factory_bot.rb"
end

#set_up_factory_lintObject



15
16
17
# File 'lib/suspenders/generators/factories_generator.rb', line 15

def set_up_factory_lint
  copy_file 'factory_bot.rake', 'lib/tasks/factory_bot.rake'
end