Sha256: 90c3f62a40e9f9ebde05b105df7ae6db8e8adf3065f639becfc3909d06e51014
Contents?: true
Size: 906 Bytes
Versions: 4
Compression:
Stored size: 906 Bytes
Contents
require 'generators/factory_girl' require 'factory_girl_rails' module FactoryGirl module Generators class ModelGenerator < Base argument :attributes, :type => :array, :default => [], :banner => "field:type field:type" class_option :dir, :type => :string, :default => "test/factories", :desc => "The directory where the factories should go" def create_fixture_file filename = [table_name, filename_suffix].compact.join('_') template 'fixtures.erb', File.join(options[:dir], "#{filename}.rb") end private def filename_suffix factory_girl_options[:suffix] end def generators config = FactoryGirl::Railtie.config config.respond_to?(:app_generators) ? config.app_generators : config.generators end def factory_girl_options generators.options[:factory_girl] || {} end end end end
Version data entries
4 entries across 4 versions & 1 rubygems