blob: 760917896f4afd60024c9f381120a0d939c4cdac (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
require 'rails/generators/test_unit'
require 'rails/generators/resource_helpers'
module TestUnit
module Generators
class ScaffoldGenerator < Base
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/functional', controller_class_path, "#{controller_file_name}_controller_test.rb")
end
private
def accessible_attributes
attributes.reject(&:reference?).map {|a| "\"#{a.name}\"" }.sort.join(', ')
end
end
end
end
|