Class: Railg::FbotGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Railg::FbotGenerator
- Defined in:
- lib/generators/railg/fbot/fbot_generator.rb
Instance Method Summary collapse
Instance Method Details
#after_bundle_do ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/railg/fbot/fbot_generator.rb', line 11 def after_bundle_do create_file 'spec/support/factory_bot.rb', <<~CODE # frozen_string_literal: true RSpec.configure do |config| config.include FactoryBot::Syntax::Methods end CODE insert_into_file 'spec/rails_helper.rb', <<~EOT, after: "# Add additional requires below this line. Rails is not loaded until this point!\n" require_relative 'support/factory_bot.rb' EOT end |
#exec_bundle ⇒ Object
7 8 9 |
# File 'lib/generators/railg/fbot/fbot_generator.rb', line 7 def exec_bundle run 'bundle' end |
#gem_add ⇒ Object
3 4 5 |
# File 'lib/generators/railg/fbot/fbot_generator.rb', line 3 def gem_add gem 'factory_bot_rails', group: %i[development test] end |