Sha256: 82adf23693ef7b3720aea089f7404d5a677c3a95dfbff8c7cc93b5be190b0e5d

Contents?: true

Size: 813 Bytes

Versions: 1

Compression:

Stored size: 813 Bytes

Contents

require 'rails/generators/test_unit'
require 'rails/generators/resource_helpers'

module TestUnit # :nodoc:
  module Generators # :nodoc:
    class ScaffoldGenerator < Base # :nodoc:
      include Rails::Generators::ResourceHelpers

      check_class_collision suffix: "ControllerTest"

      argument :attributes, type: :array, default: [], banner: "field:type field:type"

      def create_test_files
        template "functional_test.rb",
                 File.join("test/controllers", controller_class_path, "#{controller_file_name}_controller_test.rb")
      end

      private

        def attributes_hash
          return if attributes_names.empty?

          attributes_names.map do |name|
            "#{name}: @#{singular_table_name}.#{name}"
          end.sort.join(', ')
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
railties-4.0.0.beta1 lib/rails/generators/test_unit/scaffold/scaffold_generator.rb