class FactoryBotRails::Generator

Public Class Methods

new(config) click to toggle source
# File lib/factory_bot_rails/generator.rb, line 7
def initialize(config)
  @generators = config.app_generators
end

Public Instance Methods

factory_bot_disabled?() click to toggle source
# File lib/factory_bot_rails/generator.rb, line 29
def factory_bot_disabled?
  rails_options[:factory_bot] == false
end
generator() click to toggle source
# File lib/factory_bot_rails/generator.rb, line 15
def generator
  return Generators::NullGenerator if factory_bot_disabled?

  if test_framework == :rspec
    Generators::RSpecGenerator
  else
    Generators::NonRSpecGenerator
  end
end
rails_options() click to toggle source
# File lib/factory_bot_rails/generator.rb, line 33
def rails_options
  @generators.options[:rails]
end
run() click to toggle source
# File lib/factory_bot_rails/generator.rb, line 11
def run
  generator.new(@generators).run
end
test_framework() click to toggle source
# File lib/factory_bot_rails/generator.rb, line 25
def test_framework
  rails_options[:test_framework]
end