Class: Boring::Rspec::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Boring::Rspec::InstallGenerator
- Defined in:
- lib/generators/boring/rspec/install/install_generator.rb
Instance Method Summary collapse
- #add_factory_bot ⇒ Object
- #add_faker_gem ⇒ Object
- #add_rspec_gem ⇒ Object
- #add_rspec_initializer ⇒ Object
- #run_rspec_active_record_generator ⇒ Object
Instance Method Details
#add_factory_bot ⇒ Object
37 38 39 40 41 |
# File 'lib/generators/boring/rspec/install/install_generator.rb', line 37 def add_factory_bot return if [:skip_factory_bot] Rails::Command.invoke :generate, ["boring:factory_bot:install"] end |
#add_faker_gem ⇒ Object
43 44 45 46 47 |
# File 'lib/generators/boring/rspec/install/install_generator.rb', line 43 def add_faker_gem return if [:skip_faker] Rails::Command.invoke :generate, ["boring:faker:install"] end |
#add_rspec_gem ⇒ Object
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_initializer ⇒ Object
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_generator ⇒ Object
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 |