Sha256: f1bce8774accd3f01f7aa0fc86c61b8528f65ff8169c92c14554d6d5fc626b6a
Contents?: true
Size: 988 Bytes
Versions: 4
Compression:
Stored size: 988 Bytes
Contents
require 'generators/my_scaffold_generator' module MySpec module Generators class ModelGenerator < Rails::Generators::NamedBase include MyGenerators::Generators::MyScaffoldGenerator class_option :fixture, :type => :boolean argument :attributes, :type => :array, :default => [], :banner => "field:type field:type" def copy_spec_support_files empty_directory 'spec/support' template 'mongoid.rb', 'spec/support/mongoid.rb' end def create_model_spec template 'model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb") end hook_for :fixture_replacement def create_fixture_file if options[:fixture] && options[:fixture_replacement].nil? template 'fixtures.yml', File.join('spec/fixtures', "#{table_name}.yml") end end def self.source_root @source_root ||= File.expand_path("templates", File.dirname(__FILE__)) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems