Class: FactoryBot::Generators::Base

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/factory_bot.rb

Overview

:nodoc:

Direct Known Subclasses

ModelGenerator

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject


6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/factory_bot.rb', line 6

def self.source_root
  path = File.join(
    File.dirname(__FILE__),
    "factory_bot",
    generator_name,
    "templates",
  )

  File.expand_path(path)
end

Instance Method Details

#explicit_class_optionObject


17
18
19
20
21
# File 'lib/generators/factory_bot.rb', line 17

def explicit_class_option
  return if class_name == singular_table_name.camelize

  ", class: '#{class_name}'"
end