Class: TestUnit::Generators::ScaffoldGenerator

Inherits:
Base show all
Includes:
Rails::Generators::ResourceHelpers
Defined in:
lib/rails/generators/test_unit/scaffold/scaffold_generator.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from Rails::Generators::ResourceHelpers

included, #initialize

Methods inherited from Rails::Generators::NamedBase

#initialize

Methods inherited from Rails::Generators::Base

base_root, class_option, default_source_root, desc, hide!, hook_for, inherited, namespace, remove_hook_for, source_root

Methods included from Rails::Generators::Actions

#add_source, #after_bundle, #capify!, #environment, #gem, #gem_group, #generate, #git, #initialize, #initializer, #lib, #rails_command, #rake, #rakefile, #readme, #route, #vendor

Instance Method Details

#create_test_filesObject



16
17
18
19
20
# File 'lib/rails/generators/test_unit/scaffold/scaffold_generator.rb', line 16

def create_test_files
  template_file = options.api? ? "api_functional_test.rb" : "functional_test.rb"
  template template_file,
           File.join("test/controllers", controller_class_path, "#{controller_file_name}_controller_test.rb")
end

#fixture_nameObject



22
23
24
25
26
27
28
29
# File 'lib/rails/generators/test_unit/scaffold/scaffold_generator.rb', line 22

def fixture_name
  @fixture_name ||=
    if mountable_engine?
      (namespace_dirs + [table_name]).join("_")
    else
      table_name
    end
end