class Railg::FbotGenerator

Public Instance Methods

after_bundle_do() click to toggle source
# 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() click to toggle source
# File lib/generators/railg/fbot/fbot_generator.rb, line 7
def exec_bundle
  run 'bundle'
end
gem_add() click to toggle source
# File lib/generators/railg/fbot/fbot_generator.rb, line 3
def gem_add
  gem 'factory_bot_rails', group: %i[development test]
end