Class: TestUnit::Generators::ModelGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/rails/generators/test_unit/model/model_generator.rb

Overview

:nodoc:

Constant Summary collapse

RESERVED_YAML_KEYWORDS =
%w(y yes n no true false on off null)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



7
8
9
# File 'lib/rails/generators/test_unit/model/model_generator.rb', line 7

def self.source_root
  File.expand_path(File.join('test_unit/model/templates'), base_root)
end

Instance Method Details

#create_fixture_fileObject



24
25
26
27
28
29
30
# File 'lib/rails/generators/test_unit/model/model_generator.rb', line 24

def create_fixture_file
  target_dir = in_an_engine_context? ? 'lib/fixtures' : 'test/fixtures'

  if options[:fixture] && options[:fixture_replacement].nil?
    template 'fixtures.yml', File.join(target_dir, class_path, "#{plural_file_name}.yml")
  end
end

#create_test_fileObject



18
19
20
# File 'lib/rails/generators/test_unit/model/model_generator.rb', line 18

def create_test_file
  template 'unit_test.rb', File.join('test/models', class_path, "#{file_name}_test.rb")
end