Class: Minitest::Generators::ScaffoldGenerator

Inherits:
Base
  • Object
show all
Includes:
Rails::Generators::ResourceHelpers
Defined in:
lib/generators/minitest/scaffold/scaffold_generator.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Base

default_source_root, #spec_expectation_monad, #test_file_type

Instance Method Details

#create_test_filesObject



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

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

  if !options.api? && options[:system_tests]
    template "system_#{test_file_type}.rb", File.join("test/system", class_path, "#{file_name.pluralize}_test.rb")
  end
end

#fixture_nameObject



31
32
33
34
35
36
37
38
# File 'lib/generators/minitest/scaffold/scaffold_generator.rb', line 31

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