1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Get generators tests running on Ruby 1.9.1

This commit is contained in:
José Valim 2010-01-19 00:07:11 +01:00
parent 93d64dfefc
commit a18dd52d58
21 changed files with 53 additions and 31 deletions

View file

@ -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]

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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]

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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/

View file

@ -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"

View file

@ -3,7 +3,8 @@ require 'generators/rails/model/model_generator'
require 'generators/test_unit/model/model_generator'
require 'mocha'
class GeneratorsTest < GeneratorsTestCase
class GeneratorsTest < Rails::Generators::TestCase
include GeneratorsTestHelper
def setup
@path = File.expand_path("lib", Rails.root)