mirror of
https://github.com/thoughtbot/factory_bot_rails.git
synced 2022-11-09 11:49:18 -05:00
24 lines
503 B
Ruby
24 lines
503 B
Ruby
require "rails/generators/named_base"
|
|
|
|
module FactoryBot
|
|
module Generators
|
|
class Base < Rails::Generators::NamedBase #:nodoc:
|
|
def self.source_root
|
|
path = File.join(
|
|
File.dirname(__FILE__),
|
|
"factory_bot",
|
|
generator_name,
|
|
"templates",
|
|
)
|
|
|
|
File.expand_path(path)
|
|
end
|
|
|
|
def explicit_class_option
|
|
return if class_name == singular_table_name.camelize
|
|
|
|
", class: '#{class_name}'"
|
|
end
|
|
end
|
|
end
|
|
end
|