class FactoryGirlRails::Generator

Public Class Methods

new(config) click to toggle source
# File lib/factory_girl_rails/generator.rb, line 7
def initialize(config)
  @generators = if config.respond_to?(:app_generators)
                  config.app_generators
                else
                  config.generators
                end
end

Public Instance Methods

factory_girl_disabled?() click to toggle source
# File lib/factory_girl_rails/generator.rb, line 35
def factory_girl_disabled?
  rails_options[:factory_girl] == false
end
generator() click to toggle source
# File lib/factory_girl_rails/generator.rb, line 19
def generator
  if factory_girl_disabled?
    Generators::NullGenerator
  else
    if test_framework == :rspec
      Generators::RSpecGenerator
    else
      Generators::NonRSpecGenerator
    end
  end
end
rails_options() click to toggle source
# File lib/factory_girl_rails/generator.rb, line 39
def rails_options
  @generators.options[:rails]
end
run() click to toggle source
# File lib/factory_girl_rails/generator.rb, line 15
def run
  generator.new(@generators).run
end
test_framework() click to toggle source
# File lib/factory_girl_rails/generator.rb, line 31
def test_framework
  rails_options[:test_framework]
end