diff options
Diffstat (limited to 'railties/test/generators')
20 files changed, 51 insertions, 30 deletions
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index c5651b37fa..cb1fa96e0d 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -4,7 +4,8 @@ require 'generators/rails/app/app_generator' # TODO This line shouldn't be required require 'generators/rails/model/model_generator' -class ActionsTest < GeneratorsTestCase +class ActionsTest < Rails::Generators::TestCase + include GeneratorsTestHelper tests Rails::Generators::AppGenerator arguments [destination_root] diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index f961a95203..f821f5caf3 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -2,7 +2,8 @@ require 'abstract_unit' require 'generators/generators_test_helper' require 'generators/rails/app/app_generator' -class AppGeneratorTest < GeneratorsTestCase +class AppGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments [destination_root] def setup diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb index 501858c048..79a4e5bf17 100644 --- a/railties/test/generators/controller_generator_test.rb +++ b/railties/test/generators/controller_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/controller/controller_generator' -class ControllerGeneratorTest < GeneratorsTestCase +class ControllerGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(Account foo bar) def test_help_does_not_show_invoked_generators_options_if_they_already_exist diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb index 1a4c80fafb..f3fd688e4f 100644 --- a/railties/test/generators/generator_generator_test.rb +++ b/railties/test/generators/generator_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/generator/generator_generator' -class GeneratorGeneratorTest < GeneratorsTestCase +class GeneratorGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(awesome) def test_generator_skeleton_is_created diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index 1fbd60d39d..3cd16a69f9 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -13,17 +13,16 @@ require 'rails/generators/test_case' require 'active_record' require 'action_dispatch' -class GeneratorsTestCase < Rails::Generators::TestCase - destination File.join(Rails.root, "tmp") - setup :prepare_destination +module GeneratorsTestHelper + def self.included(base) + base.class_eval do + destination File.join(Rails.root, "tmp") + setup :prepare_destination - def self.inherited(base) - base.tests Rails::Generators.const_get(base.name.sub(/Test$/, '')) - rescue - # Do nothing. - end - - def test_truth - # Don't cry test/unit + begin + base.tests Rails::Generators.const_get(base.name.sub(/Test$/, '')) + rescue + end + end end end
\ No newline at end of file diff --git a/railties/test/generators/helper_generator_test.rb b/railties/test/generators/helper_generator_test.rb index 268814f885..6d7168738e 100644 --- a/railties/test/generators/helper_generator_test.rb +++ b/railties/test/generators/helper_generator_test.rb @@ -4,7 +4,8 @@ require 'generators/rails/helper/helper_generator' ObjectHelper = Class.new AnotherObjectHelperTest = Class.new -class HelperGeneratorTest < GeneratorsTestCase +class HelperGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(admin) def test_helper_skeleton_is_created diff --git a/railties/test/generators/integration_test_generator_test.rb b/railties/test/generators/integration_test_generator_test.rb index 668fe13ffa..d7fc324c88 100644 --- a/railties/test/generators/integration_test_generator_test.rb +++ b/railties/test/generators/integration_test_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/integration_test/integration_test_generator' -class IntegrationTestGeneratorTest < GeneratorsTestCase +class IntegrationTestGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(integration) def test_integration_test_skeleton_is_created diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index 50f5c7ec86..deabfb432c 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/mailer/mailer_generator' -class MailerGeneratorTest < GeneratorsTestCase +class MailerGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(notifier foo bar) def test_mailer_skeleton_is_created diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb index 9f61a50c9a..e3a2384885 100644 --- a/railties/test/generators/metal_generator_test.rb +++ b/railties/test/generators/metal_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/metal/metal_generator' -class MetalGeneratorTest < GeneratorsTestCase +class MetalGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(foo) def test_metal_skeleton_is_created diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 6d61250655..811a712fd5 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -1,7 +1,9 @@ require 'generators/generators_test_helper' require 'generators/rails/migration/migration_generator' -class MigrationGeneratorTest < GeneratorsTestCase +class MigrationGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper + def test_migration migration = "change_title_body_from_posts" run_generator [migration] diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index fb1c41e6af..79ce9a2a7b 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/model/model_generator' -class ModelGeneratorTest < GeneratorsTestCase +class ModelGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(Account name:string age:integer) def test_help_shows_invoked_generators_options diff --git a/railties/test/generators/named_base_test.rb b/railties/test/generators/named_base_test.rb index 01bb85a352..99eb431a49 100644 --- a/railties/test/generators/named_base_test.rb +++ b/railties/test/generators/named_base_test.rb @@ -11,7 +11,8 @@ module ActiveRecord end end -class NamedBaseTest < GeneratorsTestCase +class NamedBaseTest < Rails::Generators::TestCase + include GeneratorsTestHelper tests Rails::Generators::ScaffoldControllerGenerator def test_named_generator_attributes diff --git a/railties/test/generators/observer_generator_test.rb b/railties/test/generators/observer_generator_test.rb index 859c3e682a..058a19228d 100644 --- a/railties/test/generators/observer_generator_test.rb +++ b/railties/test/generators/observer_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/observer/observer_generator' -class ObserverGeneratorTest < GeneratorsTestCase +class ObserverGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(account) def test_invokes_default_orm diff --git a/railties/test/generators/performance_test_generator_test.rb b/railties/test/generators/performance_test_generator_test.rb index b5ca1ae5f6..c95063a127 100644 --- a/railties/test/generators/performance_test_generator_test.rb +++ b/railties/test/generators/performance_test_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/performance_test/performance_test_generator' -class PerformanceTestGeneratorTest < GeneratorsTestCase +class PerformanceTestGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(performance) def test_performance_test_skeleton_is_created diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index 94c3b56ebc..4bfe210efb 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/plugin/plugin_generator' -class PluginGeneratorTest < GeneratorsTestCase +class PluginGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(plugin_fu) def test_plugin_skeleton_is_created diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index 4c969e9d82..959934bd71 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/resource/resource_generator' -class ResourceGeneratorTest < GeneratorsTestCase +class ResourceGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(account) def setup diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index 1188b32e76..f971598d18 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -6,7 +6,8 @@ module Unknown end end -class ScaffoldControllerGeneratorTest < GeneratorsTestCase +class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(User name:string age:integer) def test_controller_skeleton_is_created diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index d3ff3e7c08..a7e9c8a231 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -1,7 +1,8 @@ require 'generators/generators_test_helper' require 'generators/rails/scaffold/scaffold_generator' -class ScaffoldGeneratorTest < GeneratorsTestCase +class ScaffoldGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper arguments %w(product_line title:string price:integer) def setup diff --git a/railties/test/generators/session_migration_generator_test.rb b/railties/test/generators/session_migration_generator_test.rb index 3ccda075e8..de28b4c75b 100644 --- a/railties/test/generators/session_migration_generator_test.rb +++ b/railties/test/generators/session_migration_generator_test.rb @@ -1,7 +1,9 @@ require 'generators/generators_test_helper' require 'generators/rails/session_migration/session_migration_generator' -class SessionMigrationGeneratorTest < GeneratorsTestCase +class SessionMigrationGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper + def test_session_migration_with_default_name run_generator assert_migration "db/migrate/add_sessions_table.rb", /class AddSessionsTable < ActiveRecord::Migration/ diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb index bc2eacbe68..718fcb1fa7 100644 --- a/railties/test/generators/stylesheets_generator_test.rb +++ b/railties/test/generators/stylesheets_generator_test.rb @@ -1,7 +1,9 @@ require 'generators/generators_test_helper' require 'generators/rails/stylesheets/stylesheets_generator' -class StylesheetsGeneratorTest < GeneratorsTestCase +class StylesheetsGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper + def test_copy_stylesheets run_generator assert_file "public/stylesheets/scaffold.css" |