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, inherited

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
# File 'lib/suspenders/generators/factories_generator.rb', line 5

def add_factory_bot
  gem "factory_bot_rails", group: %i[development test]
  Bundler.with_unbundled_env { run "bundle install" }
end

#generate_empty_factories_fileObject


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

def generate_empty_factories_file
  copy_file "factories.rb", "spec/factories.rb"
end

#provide_dev_prime_taskObject


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

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

#set_up_factory_bot_for_rspecObject


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

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