2011-07-11 23:11:06 -04:00
|
|
|
require 'rails/generators/named_base'
|
|
|
|
|
2016-12-02 10:25:09 -05:00
|
|
|
module FactoryBot
|
2011-07-11 23:11:06 -04:00
|
|
|
module Generators
|
|
|
|
class Base < Rails::Generators::NamedBase #:nodoc:
|
|
|
|
def self.source_root
|
2016-12-02 10:25:09 -05:00
|
|
|
@_factory_bot_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'factory_bot', generator_name, 'templates'))
|
2011-07-11 23:11:06 -04:00
|
|
|
end
|
2012-02-26 13:58:48 -05:00
|
|
|
|
|
|
|
def explicit_class_option
|
2014-10-23 18:48:47 -04:00
|
|
|
", class: '#{class_name}'" unless class_name == singular_table_name.camelize
|
2012-02-26 13:58:48 -05:00
|
|
|
end
|
2011-07-11 23:11:06 -04:00
|
|
|
end
|
|
|
|
end
|
2012-02-26 13:58:48 -05:00
|
|
|
end
|