mirror of
https://github.com/thoughtbot/factory_bot_rails.git
synced 2022-11-09 11:49:18 -05:00
7df9c9b13a
The factory name for the model Namespaced::User wil be :namespaced_user. The :class option is specified as a string to prevent class reloading issues. Addresses GH-44
15 lines
455 B
Ruby
15 lines
455 B
Ruby
require 'rails/generators/named_base'
|
|
|
|
module FactoryGirl
|
|
module Generators
|
|
class Base < Rails::Generators::NamedBase #:nodoc:
|
|
def self.source_root
|
|
@_factory_girl_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'factory_girl', generator_name, 'templates'))
|
|
end
|
|
|
|
def explicit_class_option
|
|
", :class => '#{class_name}'" unless class_name == singular_table_name.camelize
|
|
end
|
|
end
|
|
end
|
|
end
|