Class: Boring::Rspec::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/boring/rspec/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_factory_botObject



37
38
39
40
41
# File 'lib/generators/boring/rspec/install/install_generator.rb', line 37

def add_factory_bot
  return if options[:skip_factory_bot]

  Rails::Command.invoke :generate, ["boring:factory_bot:install"]
end

#add_faker_gemObject



43
44
45
46
47
# File 'lib/generators/boring/rspec/install/install_generator.rb', line 43

def add_faker_gem
  return if options[:skip_faker]

  Rails::Command.invoke :generate, ["boring:faker:install"]
end

#add_rspec_gemObject



14
15
16
17
18
19
# File 'lib/generators/boring/rspec/install/install_generator.rb', line 14

def add_rspec_gem
  log :adding, "rspec-rails"
  Bundler.with_unbundled_env do
    run "bundle add rspec-rails --group='development,test'"
  end
end

#add_rspec_initializerObject



28
29
30
31
32
33
34
35
# File 'lib/generators/boring/rspec/install/install_generator.rb', line 28

def add_rspec_initializer
  log :override, "test_framework to rspec"
  environment <<~end_of_config
    config.generators do |g|
      g.test_framework :rspec
    end
  end_of_config
end

#run_rspec_active_record_generatorObject



21
22
23
24
25
26
# File 'lib/generators/boring/rspec/install/install_generator.rb', line 21

def run_rspec_active_record_generator
  log :running, "rspec generator"
  Bundler.with_unbundled_env do
    run "rails generate rspec:install"
  end
end