<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>railties/test/generators/rails_mailer_generator_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -11,12 +11,8 @@ class MailerGenerator &lt; Rails::Generator::NamedBase
       m.directory File.join('test/fixtures', file_path)
 
       # Mailer class and unit test.
-      m.template &quot;mailer.rb&quot;,    File.join('app/models',
-                                           class_path,
-                                           &quot;#{file_name}.rb&quot;)
-      m.template &quot;unit_test.rb&quot;, File.join('test/unit',
-                                           class_path,
-                                           &quot;#{file_name}_test.rb&quot;)
+      m.template &quot;mailer.rb&quot;,    File.join('app/models', class_path, &quot;#{file_name}.rb&quot;)
+      m.template &quot;unit_test.rb&quot;, File.join('test/unit', class_path, &quot;#{file_name}_test.rb&quot;)
 
       # View template and fixture for each action.
       actions.each do |action|</diff>
      <filename>railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,51 @@
+require 'test/unit'
+require 'fileutils'
+
+# Mock out what we need from AR::Base
+module ActiveRecord
+  class Base
+    class &lt;&lt; self
+      attr_accessor :pluralize_table_names
+    end
+    self.pluralize_table_names = true
+  end
+
+  module ConnectionAdapters
+    class Column
+      attr_reader :name, :default, :type, :limit, :null, :sql_type, :precision, :scale
+      
+      def initialize(name, default, sql_type = nil)
+        @name = name
+        @default = default
+        @type = @sql_type = sql_type
+      end
+
+      def human_name
+        @name.humanize
+      end
+    end
+  end
+end
+
+# Mock up necessities from ActionView
+module ActionView
+  module Helpers
+    module ActionRecordHelper; end
+    class InstanceTag; end
+  end
+end
+
+# Set RAILS_ROOT appropriately fixture generation
+tmp_dir = &quot;#{File.dirname(__FILE__)}/../fixtures/tmp&quot;
+
+if defined? RAILS_ROOT
+  RAILS_ROOT.replace tmp_dir
+else
+  RAILS_ROOT = tmp_dir
+end
+FileUtils.mkdir_p RAILS_ROOT
+
+$LOAD_PATH.unshift &quot;#{File.dirname(__FILE__)}/../../lib&quot;
 require 'initializer'
 
 # Mocks out the configuration
@@ -9,35 +57,62 @@ end
 
 require 'rails_generator'
 
+class GeneratorTestCase &lt; Test::Unit::TestCase
+  include FileUtils
+  
+  def setup
+    ActiveRecord::Base.pluralize_table_names = true
+    
+    mkdir_p &quot;#{RAILS_ROOT}/app/views/layouts&quot;
+    mkdir_p &quot;#{RAILS_ROOT}/config&quot;
+    mkdir_p &quot;#{RAILS_ROOT}/db&quot;
+    mkdir_p &quot;#{RAILS_ROOT}/test/fixtures&quot;
+    mkdir_p &quot;#{RAILS_ROOT}/public/stylesheets&quot;
+    
+    File.open(&quot;#{RAILS_ROOT}/config/routes.rb&quot;, 'w') do |f|
+      f &lt;&lt; &quot;ActionController::Routing::Routes.draw do |map|\n\nend&quot;
+    end
+  end
 
-module GeneratorTestHelper
+  def teardown
+    rm_rf &quot;#{RAILS_ROOT}/app&quot;
+    rm_rf &quot;#{RAILS_ROOT}/test&quot;
+    rm_rf &quot;#{RAILS_ROOT}/config&quot;
+    rm_rf &quot;#{RAILS_ROOT}/db&quot;
+    rm_rf &quot;#{RAILS_ROOT}/public&quot;
+  end
+
+  def test_truth
+    # don't complain, test/unit
+  end
+  
   # Instantiates the Generator
-  def build_generator(name,params)
-    Rails::Generator::Base.instance(name,params)
+  def build_generator(name, params)
+    Rails::Generator::Base.instance(name, params)
   end
 
   # Runs the create command (like the command line does)
-  def run_generator(name,params)
+  def run_generator(name, params)
     silence_generator do
-      build_generator(name,params).command(:create).invoke!
+      build_generator(name, params).command(:create).invoke!
     end
   end
 
   # Silences the logger temporarily and returns the output as a String
   def silence_generator
-    logger_original=Rails::Generator::Base.logger
-    myout=StringIO.new
-    Rails::Generator::Base.logger=Rails::Generator::SimpleLogger.new(myout)
+    logger_original = Rails::Generator::Base.logger
+    myout = StringIO.new
+    Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new(myout)
     yield if block_given?
-    Rails::Generator::Base.logger=logger_original
+    Rails::Generator::Base.logger = logger_original
     myout.string
   end
 
   # asserts that the given controller was generated.
   # It takes a name or symbol without the &lt;tt&gt;_controller&lt;/tt&gt; part and an optional super class.
   # The contents of the class source file is passed to a block.
-  def assert_generated_controller_for(name,parent=&quot;ApplicationController&quot;)
-    assert_generated_class &quot;app/controllers/#{name.to_s.underscore}_controller&quot;,parent do |body|
+  def assert_generated_controller_for(name, parent = &quot;ApplicationController&quot;)
+    assert_generated_class &quot;app/controllers/#{name.to_s.underscore}_controller&quot;, parent do |body|
       yield body if block_given?
     end
   end
@@ -45,8 +120,8 @@ module GeneratorTestHelper
   # asserts that the given model was generated.
   # It takes a name or symbol and an optional super class.
   # the contents of the class source file is passed to a block.
-  def assert_generated_model_for(name,parent=&quot;ActiveRecord::Base&quot;)
-    assert_generated_class &quot;app/models/#{name.to_s.underscore}&quot;,parent do |body|
+  def assert_generated_model_for(name, parent = &quot;ActiveRecord::Base&quot;)
+    assert_generated_class &quot;app/models/#{name.to_s.underscore}&quot;, parent do |body|
       yield body if block_given?
     end
   end
@@ -63,7 +138,7 @@ module GeneratorTestHelper
   # asserts that the given functional test was generated.
   # It takes a name or symbol without the &lt;tt&gt;_controller_test&lt;/tt&gt; part and an optional super class.
   # the contents of the class source file is passed to a block.
-  def assert_generated_functional_test_for(name,parent=&quot;ActionController::TestCase&quot;)
+  def assert_generated_functional_test_for(name, parent = &quot;ActionController::TestCase&quot;)
     assert_generated_class &quot;test/functional/#{name.to_s.underscore}_controller_test&quot;,parent do |body|
       yield body if block_given?
     end
@@ -72,8 +147,8 @@ module GeneratorTestHelper
   # asserts that the given unit test was generated.
   # It takes a name or symbol without the &lt;tt&gt;_test&lt;/tt&gt; part and an optional super class.
   # the contents of the class source file is passed to a block.
-  def assert_generated_unit_test_for(name,parent=&quot;ActiveSupport::TestCase&quot;)
-    assert_generated_class &quot;test/unit/#{name.to_s.underscore}_test&quot;,parent do |body|
+  def assert_generated_unit_test_for(name, parent = &quot;ActiveSupport::TestCase&quot;)
+    assert_generated_class &quot;test/unit/#{name.to_s.underscore}_test&quot;, parent do |body|
       yield body if block_given?
     end
   end
@@ -89,17 +164,18 @@ module GeneratorTestHelper
 
   # asserts that the given file exists
   def assert_file_exists(path)
-    assert File.exist?(&quot;#{RAILS_ROOT}/#{path}&quot;),&quot;The file '#{RAILS_ROOT}/#{path}' should exist&quot;
+    assert File.exist?(&quot;#{RAILS_ROOT}/#{path}&quot;),
+      &quot;The file '#{RAILS_ROOT}/#{path}' should exist&quot;
   end
 
   # asserts that the given class source file was generated.
   # It takes a path without the &lt;tt&gt;.rb&lt;/tt&gt; part and an optional super class.
   # the contents of the class source file is passed to a block.
-  def assert_generated_class(path,parent=nil)
-    path=~/\/?(\d+_)?(\w+)$/
-    class_name=$2.camelize
+  def assert_generated_class(path, parent=nil)
+    path =~ /\/?(\d+_)?(\w+)$/
+    class_name = $2.camelize
     assert_generated_file(&quot;#{path}.rb&quot;) do |body|
-      assert body=~/class #{class_name}#{parent.nil? ? '':&quot; &lt; #{parent}&quot;}/,&quot;the file '#{path}.rb' should be a class&quot;
+      assert_match /class #{class_name}#{parent.nil? ? '':&quot; &lt; #{parent}&quot;}/, body, &quot;the file '#{path}.rb' should be a class&quot;
       yield body if block_given?
     end
   end
@@ -108,10 +184,10 @@ module GeneratorTestHelper
   # It takes a path without the &lt;tt&gt;.rb&lt;/tt&gt; part.
   # the contents of the class source file is passed to a block.
   def assert_generated_module(path)
-    path=~/\/?(\w+)$/
-    module_name=$1.camelize
+    path =~ /\/?(\w+)$/
+    module_name = $1.camelize
     assert_generated_file(&quot;#{path}.rb&quot;) do |body|
-      assert body=~/module #{module_name}/,&quot;the file '#{path}.rb' should be a module&quot;
+      assert_match /module #{module_name}/, body, &quot;the file '#{path}.rb' should be a module&quot;
       yield body if block_given?
     end
   end
@@ -130,7 +206,8 @@ module GeneratorTestHelper
   # the parsed yaml tree is passed to a block.
   def assert_generated_yaml(path)
     assert_generated_file(&quot;#{path}.yml&quot;) do |body|
-      assert yaml=YAML.load(body)
+      yaml = YAML.load(body)
+      assert yaml, 'YAML data missing'
       yield yaml if block_given?
     end
   end
@@ -147,23 +224,22 @@ module GeneratorTestHelper
   # asserts that the given views were generated.
   # It takes a controller name and a list of views (including extensions).
   # The body of each view is passed to a block
-  def assert_generated_views_for(name,*actions)
+  def assert_generated_views_for(name, *actions)
     actions.each do |action|
-      assert_generated_file(&quot;app/views/#{name.to_s.underscore}/#{action.to_s}&quot;) do |body|
+      assert_generated_file(&quot;app/views/#{name.to_s.underscore}/#{action}&quot;) do |body|
         yield body if block_given?
       end
     end
   end
 
-  def assert_generated_migration(name,parent=&quot;ActiveRecord::Migration&quot;)
-      file =
-   Dir.glob(&quot;#{RAILS_ROOT}/db/migrate/*_#{name.to_s.underscore}.rb&quot;).first
-      file = file.match(/db\/migrate\/[0-9]+_#{name.to_s.underscore}/).to_s
-      assert_generated_class file,parent do |body|
-        assert body=~/timestamps/, &quot;should have timestamps defined&quot;
-        yield body if block_given?
-      end
+  def assert_generated_migration(name, parent = &quot;ActiveRecord::Migration&quot;)
+    file = Dir.glob(&quot;#{RAILS_ROOT}/db/migrate/*_#{name.to_s.underscore}.rb&quot;).first
+    file = file.match(/db\/migrate\/[0-9]+_\w+/).to_s
+    assert_generated_class file, parent do |body|
+      assert_match /timestamps/, body, &quot;should have timestamps defined&quot;
+      yield body if block_given?
     end
+  end
 
   # Asserts that the given migration file was not generated.
   # It takes the name of the migration as a parameter.
@@ -175,22 +251,23 @@ module GeneratorTestHelper
   # asserts that the given resource was added to the routes.
   def assert_added_route_for(name)
     assert_generated_file(&quot;config/routes.rb&quot;) do |body|
-      assert body=~/map.resources :#{name.to_s.underscore}/,&quot;should add route for :#{name.to_s.underscore}&quot;
+      assert_match /map.resources :#{name.to_s.underscore}/, body,
+        &quot;should add route for :#{name.to_s.underscore}&quot;
     end
   end
 
   # asserts that the given methods are defined in the body.
   # This does assume standard rails code conventions with regards to the source code.
   # The body of each individual method is passed to a block.
-  def assert_has_method(body,*methods)
+  def assert_has_method(body, *methods)
     methods.each do |name|
-      assert body=~/^  def #{name.to_s}\n((\n|   .*\n)*)  end/,&quot;should have method #{name.to_s}&quot;
-      yield( name, $1 ) if block_given?
+      assert body =~ /^  def #{name}(\(.+\))?\n((\n|   .*\n)*)  end/, &quot;should have method #{name}&quot;
+      yield(name, $2) if block_given?
     end
   end
 
   # asserts that the given column is defined in the migration
-  def assert_generated_column(body,name,type)
-      assert body=~/t\.#{type.to_s} :#{name.to_s}/, &quot;should have column #{name.to_s} defined&quot;
+  def assert_generated_column(body, name, type)
+    assert_match /t\.#{type.to_s} :#{name.to_s}/, body, &quot;should have column #{name.to_s} defined&quot;
   end
 end</diff>
      <filename>railties/test/generators/generator_test_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,84 +1,6 @@
-require 'test/unit'
-
-# Optionally load RubyGems
-begin
-  require 'rubygems'
-rescue LoadError
-end
-
-# Mock out what we need from AR::Base
-module ActiveRecord
-  class Base
-    class &lt;&lt; self
-      attr_accessor :pluralize_table_names
-    end
-    self.pluralize_table_names = true
-  end
-
-  module ConnectionAdapters
-    class Column
-      attr_reader :name, :default, :type, :limit, :null, :sql_type, :precision, :scale
-      def initialize(name, default, sql_type=nil)
-        @namename
-        @default=default
-        @type=@sql_type=sql_type
-      end
-
-      def human_name
-        @name.humanize
-      end
-    end
-  end
-end
-
-# Mock up necessities from ActionView
-module ActionView
-  module Helpers
-    module ActionRecordHelper; end
-    class InstanceTag; end
-  end
-end
-
-# Set RAILS_ROOT appropriately fixture generation
-tmp_dir=&quot;#{File.dirname(__FILE__)}/../fixtures/tmp&quot;
-if defined?(RAILS_ROOT)
-  RAILS_ROOT.replace(tmp_dir)
-else
-  RAILS_ROOT=tmp_dir
-end
-Dir.mkdir(RAILS_ROOT) unless File.exist?(RAILS_ROOT)
-
-
-$LOAD_PATH.unshift &quot;#{File.dirname(__FILE__)}/../../lib&quot;
-
 require 'generators/generator_test_helper'
 
-class RailsModelGeneratorTest &lt; Test::Unit::TestCase
-  include GeneratorTestHelper
-
-  def setup
-    ActiveRecord::Base.pluralize_table_names = true
-    Dir.mkdir(&quot;#{RAILS_ROOT}/app&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/app&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/app/views&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/app/views&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/app/views/layouts&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/app/views/layouts&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/config&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/config&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/db&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/db&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/test&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/test&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/test/fixtures&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/test/fixtures&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/public&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/public&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/public/stylesheets&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/public/stylesheets&quot;)
-    File.open(&quot;#{RAILS_ROOT}/config/routes.rb&quot;, 'w') do |f|
-      f&lt;&lt;&quot;ActionController::Routing::Routes.draw do |map|\n\nend\n&quot;
-    end
-  end
-
-    def teardown
-    FileUtils.rm_rf &quot;#{RAILS_ROOT}/app&quot;
-    FileUtils.rm_rf &quot;#{RAILS_ROOT}/test&quot;
-    FileUtils.rm_rf &quot;#{RAILS_ROOT}/config&quot;
-    FileUtils.rm_rf &quot;#{RAILS_ROOT}/db&quot;
-    FileUtils.rm_rf &quot;#{RAILS_ROOT}/public&quot;
-  end
+class RailsModelGeneratorTest &lt; GeneratorTestCase
 
   def test_model_generates_resources
     run_generator('model', %w(Product name:string))</diff>
      <filename>railties/test/generators/rails_model_generator_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,82 +1,6 @@
-require 'test/unit'
-
-# Optionally load RubyGems
-begin
-  require 'rubygems'
-rescue LoadError
-end
-
-# Mock out what we need from AR::Base
-module ActiveRecord
-  class Base
-    class &lt;&lt; self
-      attr_accessor :pluralize_table_names
-    end
-    self.pluralize_table_names = true
-  end
-
-  module ConnectionAdapters
-    class Column
-      attr_reader :name, :default, :type, :limit, :null, :sql_type, :precision, :scale
-      def initialize(name, default, sql_type=nil)
-        @namename
-        @default=default
-        @type=@sql_type=sql_type
-      end
-
-      def human_name
-        @name.humanize
-      end
-    end
-  end
-end
-
-# Mock up necessities from ActionView
-module ActionView
-  module Helpers
-    module ActionRecordHelper; end
-    class InstanceTag; end
-  end
-end
-
-# Set RAILS_ROOT appropriately fixture generation
-tmp_dir=&quot;#{File.dirname(__FILE__)}/../fixtures/tmp&quot;
-if defined?(RAILS_ROOT)
-  RAILS_ROOT.replace(tmp_dir)
-else
-  RAILS_ROOT=tmp_dir
-end
-Dir.mkdir(RAILS_ROOT) unless File.exist?(RAILS_ROOT)
-
-$LOAD_PATH.unshift &quot;#{File.dirname(__FILE__)}/../../lib&quot;
 require 'generators/generator_test_helper'
 
-class RailsResourceGeneratorTest &lt; Test::Unit::TestCase
-  include GeneratorTestHelper
-
-  def setup
-    ActiveRecord::Base.pluralize_table_names = true
-    Dir.mkdir(&quot;#{RAILS_ROOT}/app&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/app&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/app/views&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/app/views&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/app/views/layouts&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/app/views/layouts&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/config&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/config&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/db&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/db&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/test&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/test&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/test/fixtures&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/test/fixtures&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/public&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/public&quot;)
-    Dir.mkdir(&quot;#{RAILS_ROOT}/public/stylesheets&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/public/stylesheets&quot;)
-    File.open(&quot;#{RAILS_ROOT}/config/routes.rb&quot;, 'w') do |f|
-      f&lt;&lt;&quot;ActionController::Routing::Routes.draw do |map|\n\nend\n&quot;
-    end
-  end
-
-  def teardown
-    FileUtils.rm_rf &quot;#{RAILS_ROOT}/app&quot;
-    FileUtils.rm_rf &quot;#{RAILS_ROOT}/test&quot;
-    FileUtils.rm_rf &quot;#{RAILS_ROOT}/config&quot;
-    FileUtils.rm_rf &quot;#{RAILS_ROOT}/db&quot;
-    FileUtils.rm_rf &quot;#{RAILS_ROOT}/public&quot;
-  end
+class RailsResourceGeneratorTest &lt; GeneratorTestCase
 
   def test_resource_generates_resources
     run_generator('resource', %w(Product name:string))</diff>
      <filename>railties/test/generators/rails_resource_generator_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,189 +1,107 @@
-require 'abstract_unit'
-
-# Optionally load RubyGems.
-begin
-  require 'rubygems'
-rescue LoadError
-end
-
-# Mock out what we need from AR::Base.
-module ActiveRecord
-  class Base
-    class &lt;&lt; self
-      attr_accessor :pluralize_table_names
-    end
-    self.pluralize_table_names = true
-  end
-
-  module ConnectionAdapters
-    class Column
-      attr_reader :name, :default, :type, :limit, :null, :sql_type, :precision, :scale
-
-      def initialize(name, default, sql_type = nil)
-        @name=name
-        @default=default
-        @type=@sql_type=sql_type
-      end
-
-      def human_name
-        @name.humanize
-      end
-    end
-  end
-end
+require 'generators/generator_test_helper'
 
-# And what we need from ActionView
-module ActionView
-  module Helpers
-    module ActiveRecordHelper; end
-    class InstanceTag; end
+class RailsScaffoldGeneratorTest &lt; GeneratorTestCase
+  
+  def test_scaffolded_names
+    g = Rails::Generator::Base.instance('scaffold', %w(ProductLine))
+    assert_equal &quot;ProductLines&quot;, g.controller_name
+    assert_equal &quot;ProductLines&quot;, g.controller_class_name
+    assert_equal &quot;ProductLine&quot;, g.controller_singular_name
+    assert_equal &quot;product_lines&quot;, g.controller_plural_name
+    assert_equal &quot;product_lines&quot;, g.controller_file_name
+    assert_equal &quot;product_lines&quot;, g.controller_table_name
   end
-end
 
+  def test_scaffold_generates_resources
 
-# Must set before requiring generator libs.
-tmp_dir=&quot;#{File.dirname(__FILE__)}/../fixtures/tmp&quot;
-if defined?(RAILS_ROOT)
-  RAILS_ROOT.replace(tmp_dir)
-else
-  RAILS_ROOT=tmp_dir
-end
-Dir.mkdir(RAILS_ROOT) unless File.exist?(RAILS_ROOT)
-
-$LOAD_PATH.unshift &quot;#{File.dirname(__FILE__)}/../../lib&quot;
+    run_generator('scaffold', %w(Product name:string))
 
-require 'generators/generator_test_helper'
+    assert_generated_controller_for :products do |f|
 
-uses_mocha &quot;Scaffold Generator Tests&quot; do
-  class RailsScaffoldGeneratorTest &lt; Test::Unit::TestCase
-
-    include GeneratorTestHelper
-
-    def setup
-      ActiveRecord::Base.pluralize_table_names = true
-      Dir.mkdir(&quot;#{RAILS_ROOT}/app&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/app&quot;)
-      Dir.mkdir(&quot;#{RAILS_ROOT}/app/views&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/app/views&quot;)
-      Dir.mkdir(&quot;#{RAILS_ROOT}/app/views/layouts&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/app/views/layouts&quot;)
-      Dir.mkdir(&quot;#{RAILS_ROOT}/config&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/config&quot;)
-      Dir.mkdir(&quot;#{RAILS_ROOT}/db&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/db&quot;)
-      Dir.mkdir(&quot;#{RAILS_ROOT}/test&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/test&quot;)
-      Dir.mkdir(&quot;#{RAILS_ROOT}/test/fixtures&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/test/fixtures&quot;)
-      Dir.mkdir(&quot;#{RAILS_ROOT}/public&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/public&quot;)
-      Dir.mkdir(&quot;#{RAILS_ROOT}/public/stylesheets&quot;) unless File.exist?(&quot;#{RAILS_ROOT}/public/stylesheets&quot;)
-      File.open(&quot;#{RAILS_ROOT}/config/routes.rb&quot;, 'w') do |f|
-        f&lt;&lt;&quot;ActionController::Routing::Routes.draw do |map|\n\nend\n&quot;
+      assert_has_method f, :index do |name, m|
+        assert_match /@products = Product\.find\(:all\)/, m, &quot;#{name} should query products table&quot;
       end
-    end
-
-    def teardown
-      FileUtils.rm_rf &quot;#{RAILS_ROOT}/app&quot;
-      FileUtils.rm_rf &quot;#{RAILS_ROOT}/test&quot;
-      FileUtils.rm_rf &quot;#{RAILS_ROOT}/config&quot;
-      FileUtils.rm_rf &quot;#{RAILS_ROOT}/db&quot;
-      FileUtils.rm_rf &quot;#{RAILS_ROOT}/public&quot;
-    end
-
-    def test_scaffolded_names
-      g = Rails::Generator::Base.instance('scaffold', %w(ProductLine))
-      assert_equal &quot;ProductLines&quot;, g.controller_name
-      assert_equal &quot;ProductLines&quot;, g.controller_class_name
-      assert_equal &quot;ProductLine&quot;, g.controller_singular_name
-      assert_equal &quot;product_lines&quot;, g.controller_plural_name
-      assert_equal &quot;product_lines&quot;, g.controller_file_name
-      assert_equal &quot;product_lines&quot;, g.controller_table_name
-    end
-
-    def test_scaffold_generates_resources
-
-      run_generator('scaffold', %w(Product name:string))
 
-      assert_generated_controller_for :products do |f|
-
-        assert_has_method f, :index do |name, m|
-          assert_match /@products = Product\.find\(:all\)/, m, &quot;#{name} should query products table&quot;
-        end
-
-        assert_has_method f, :show, :edit, :update, :destroy do |name, m|
-          assert_match /@product = Product\.find\(params\[:id\]\)/, m, &quot;#{name.to_s} should query products table&quot;
-        end
-
-        assert_has_method f, :new do |name, m|
-          assert_match /@product = Product\.new/, m, &quot;#{name.to_s} should instantiate a product&quot;
-        end
-
-        assert_has_method f, :create do |name, m|
-          assert_match /@product = Product\.new\(params\[:product\]\)/, m, &quot;#{name.to_s} should instantiate a product&quot;
-          assert_match /format.xml  \{ render :xml =&gt; @product.errors, :status =&gt; :unprocessable_entity \}/, m, &quot;#{name.to_s} should set status to :unprocessable_entity code for xml&quot;
-        end
+      assert_has_method f, :show, :edit, :update, :destroy do |name, m|
+        assert_match /@product = Product\.find\(params\[:id\]\)/, m, &quot;#{name.to_s} should query products table&quot;
+      end
 
+      assert_has_method f, :new do |name, m|
+        assert_match /@product = Product\.new/, m, &quot;#{name.to_s} should instantiate a product&quot;
       end
 
-      assert_generated_model_for :product
-      assert_generated_functional_test_for :products
-      assert_generated_unit_test_for :product
-      assert_generated_fixtures_for :products
-      assert_generated_helper_for :products
-      assert_generated_stylesheet :scaffold
-      assert_generated_views_for :products, &quot;index.html.erb&quot;, &quot;new.html.erb&quot;, &quot;edit.html.erb&quot;, &quot;show.html.erb&quot;
+      assert_has_method f, :create do |name, m|
+        assert_match /@product = Product\.new\(params\[:product\]\)/, m, &quot;#{name.to_s} should instantiate a product&quot;
+        assert_match /format.xml  \{ render :xml =&gt; @product.errors, :status =&gt; :unprocessable_entity \}/, m, &quot;#{name.to_s} should set status to :unprocessable_entity code for xml&quot;
+      end
 
-      assert_generated_migration :create_products
-      assert_added_route_for :products
     end
 
-    def test_scaffold_skip_migration_skips_migration
-      run_generator('scaffold', %w(Product name:string --skip-migration))
-
-      assert_generated_model_for :product
-      assert_generated_functional_test_for :products
-      assert_generated_unit_test_for :product
-      assert_generated_fixtures_for :products
-      assert_generated_helper_for :products
-      assert_generated_stylesheet :scaffold
-      assert_generated_views_for :products, &quot;index.html.erb&quot;,&quot;new.html.erb&quot;,&quot;edit.html.erb&quot;,&quot;show.html.erb&quot;
-      assert_skipped_migration :create_products
-      assert_added_route_for :products
-    end
+    assert_generated_model_for :product
+    assert_generated_functional_test_for :products
+    assert_generated_unit_test_for :product
+    assert_generated_fixtures_for :products
+    assert_generated_helper_for :products
+    assert_generated_stylesheet :scaffold
+    assert_generated_views_for :products, &quot;index.html.erb&quot;, &quot;new.html.erb&quot;, &quot;edit.html.erb&quot;, &quot;show.html.erb&quot;
 
-    def test_scaffold_generates_resources_with_attributes
-      run_generator('scaffold', %w(Product name:string supplier_id:integer created_at:timestamp))
+    assert_generated_migration :create_products
+    assert_added_route_for :products
+  end
 
-      assert_generated_controller_for :products do |f|
+  def test_scaffold_skip_migration_skips_migration
+    run_generator('scaffold', %w(Product name:string --skip-migration))
+
+    assert_generated_model_for :product
+    assert_generated_functional_test_for :products
+    assert_generated_unit_test_for :product
+    assert_generated_fixtures_for :products
+    assert_generated_helper_for :products
+    assert_generated_stylesheet :scaffold
+    assert_generated_views_for :products, &quot;index.html.erb&quot;,&quot;new.html.erb&quot;,&quot;edit.html.erb&quot;,&quot;show.html.erb&quot;
+    assert_skipped_migration :create_products
+    assert_added_route_for :products
+  end
 
-        assert_has_method f, :index do |name, m|
-          assert_match /@products = Product\.find\(:all\)/, m, &quot;#{name} should query products table&quot;
-        end
+  def test_scaffold_generates_resources_with_attributes
+    run_generator('scaffold', %w(Product name:string supplier_id:integer created_at:timestamp))
 
-        assert_has_method f, :show, :edit, :update, :destroy do |name, m|
-          assert_match /@product = Product\.find\(params\[:id\]\)/, m, &quot;#{name.to_s} should query products table&quot;
-        end
+    assert_generated_controller_for :products do |f|
 
-        assert_has_method f, :new do |name, m|
-          assert_match /@product = Product\.new/, m, &quot;#{name.to_s} should instantiate a product&quot;
-        end
+      assert_has_method f, :index do |name, m|
+        assert_match /@products = Product\.find\(:all\)/, m, &quot;#{name} should query products table&quot;
+      end
 
-        assert_has_method f, :create do |name, m|
-          assert_match /@product = Product\.new\(params\[:product\]\)/, m, &quot;#{name.to_s} should instantiate a product&quot;
-          assert_match /format.xml  \{ render :xml =&gt; @product.errors, :status =&gt; :unprocessable_entity \}/, m, &quot;#{name.to_s} should set status to :unprocessable_entity code for xml&quot;
-        end
+      assert_has_method f, :show, :edit, :update, :destroy do |name, m|
+        assert_match /@product = Product\.find\(params\[:id\]\)/, m, &quot;#{name.to_s} should query products table&quot;
+      end
 
+      assert_has_method f, :new do |name, m|
+        assert_match /@product = Product\.new/, m, &quot;#{name.to_s} should instantiate a product&quot;
       end
 
-      assert_generated_model_for :product
-      assert_generated_functional_test_for :products
-      assert_generated_unit_test_for :product
-      assert_generated_fixtures_for :products
-      assert_generated_helper_for :products
-      assert_generated_stylesheet :scaffold
-      assert_generated_views_for :products, &quot;index.html.erb&quot;, &quot;new.html.erb&quot;, &quot;edit.html.erb&quot;, &quot;show.html.erb&quot;
-
-      assert_generated_migration :create_products do |t|
-        assert_generated_column t, :name, :string
-        assert_generated_column t, :supplier_id, :integer
-        assert_generated_column t, :created_at, :timestamp
+      assert_has_method f, :create do |name, m|
+        assert_match /@product = Product\.new\(params\[:product\]\)/, m, &quot;#{name.to_s} should instantiate a product&quot;
+        assert_match /format.xml  \{ render :xml =&gt; @product.errors, :status =&gt; :unprocessable_entity \}/, m, &quot;#{name.to_s} should set status to :unprocessable_entity code for xml&quot;
       end
 
-      assert_added_route_for :products
     end
 
+    assert_generated_model_for :product
+    assert_generated_functional_test_for :products
+    assert_generated_unit_test_for :product
+    assert_generated_fixtures_for :products
+    assert_generated_helper_for :products
+    assert_generated_stylesheet :scaffold
+    assert_generated_views_for :products, &quot;index.html.erb&quot;, &quot;new.html.erb&quot;, &quot;edit.html.erb&quot;, &quot;show.html.erb&quot;
+
+    assert_generated_migration :create_products do |t|
+      assert_generated_column t, :name, :string
+      assert_generated_column t, :supplier_id, :integer
+      assert_generated_column t, :created_at, :timestamp
+    end
+
+    assert_added_route_for :products
   end
-end
\ No newline at end of file
+
+end</diff>
      <filename>railties/test/generators/rails_scaffold_generator_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>986aec5dbbdfb578945e706cbe6a54c4f06640e5</id>
    </parent>
  </parents>
  <author>
    <name>Mislav Marohni&#263;</name>
    <email>mislav.marohnic@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/dfdb9f738e9842752c340634622624544efe18c1</url>
  <id>dfdb9f738e9842752c340634622624544efe18c1</id>
  <committed-date>2008-04-18T15:10:58-07:00</committed-date>
  <authored-date>2008-04-18T15:10:58-07:00</authored-date>
  <message>Cleanup generator tests by extracting repeated code into generator_test_helper. Add test for mailer generator.
Signed-off-by: Joshua Peek &lt;josh@joshpeek.com&gt;</message>
  <tree>48bf88138e05da9b270f947f3b0d1c8b5eda9024</tree>
  <committer>
    <name>Joshua Peek</name>
    <email>josh@joshpeek.com</email>
  </committer>
</commit>
