aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-07-03 12:32:46 +0200
committerJosé Valim <jose.valim@gmail.com>2009-07-03 14:57:46 +0200
commit3ca504c966b8cf3ad51cdccd3377efc33fccab33 (patch)
tree7a0c363e18480c3e29ab72e1ffb53e9d6734908a /railties/test
parentde68cf7e0624e7d8e7e94034858a061ca0f6f68c (diff)
downloadrails-3ca504c966b8cf3ad51cdccd3377efc33fccab33.tar.gz
rails-3ca504c966b8cf3ad51cdccd3377efc33fccab33.tar.bz2
rails-3ca504c966b8cf3ad51cdccd3377efc33fccab33.zip
Removed remaining old generators files.
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generator_lookup_test.rb42
-rw-r--r--railties/test/generators/generators_test_helper.rb8
-rw-r--r--railties/test/rails_generator_test.rb117
3 files changed, 7 insertions, 160 deletions
diff --git a/railties/test/generator_lookup_test.rb b/railties/test/generator_lookup_test.rb
deleted file mode 100644
index b67087e5ea..0000000000
--- a/railties/test/generator_lookup_test.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-require 'plugin_test_helper'
-
-class GeneratorLookupTest < Test::Unit::TestCase
- def setup
- @fixture_dirs = %w{alternate default}
- @configuration = Rails.configuration = Rails::Configuration.new
- # We need to add our testing plugin directory to the plugin paths so
- # the locator knows where to look for our plugins
- @configuration.plugin_paths += @fixture_dirs.map{|fd| plugin_fixture_path(fd)}
- @initializer = Rails::Initializer.default
- @initializer.config = @configuration
- @initializer.run(:add_plugin_load_paths)
- @initializer.run(:load_plugins)
- @initializer.run(:set_root_path)
- load 'rails_generator.rb'
- require 'rails_generator/scripts'
- end
-
- def test_should_load_from_all_plugin_paths
- assert Rails::Generator::Base.lookup('a_generator')
- assert Rails::Generator::Base.lookup('stubby_generator')
- end
-
- def test_should_create_generator_source_for_each_directory_in_plugin_paths
- sources = Rails::Generator::Base.sources
- @fixture_dirs.each do |gen_dir|
- expected_label = "plugins (fixtures/plugins/#{gen_dir})".to_sym
- assert sources.any? {|source| source.label == expected_label }
- end
- end
-
- def test_should_preserve_order_in_usage_message
- msg = Rails::Generator::Scripts::Base.new.send(:usage_message)
- positions = @fixture_dirs.map do |gen_dir|
- pos = msg.index("Plugins (fixtures/plugins/#{gen_dir})")
- assert_not_nil pos
- pos
- end
- assert_equal positions.sort, positions
- end
-
-end
diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb
index 782118aeb0..7f22197a54 100644
--- a/railties/test/generators/generators_test_helper.rb
+++ b/railties/test/generators/generators_test_helper.rb
@@ -1,10 +1,16 @@
require 'test/unit'
require 'fileutils'
-require 'mocha'
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib"
require 'generators'
+fixtures = File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures'))
+if defined?(RAILS_ROOT)
+ RAILS_ROOT.replace fixtures
+else
+ RAILS_ROOT = fixtures
+end
+
class GeneratorsTestCase < Test::Unit::TestCase
include FileUtils
diff --git a/railties/test/rails_generator_test.rb b/railties/test/rails_generator_test.rb
deleted file mode 100644
index 5a1409fc2e..0000000000
--- a/railties/test/rails_generator_test.rb
+++ /dev/null
@@ -1,117 +0,0 @@
-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 << self
- attr_accessor :pluralize_table_names
- end
- self.pluralize_table_names = true
- end
-end
-
-# And what we need from ActionView
-module ActionView
- module Helpers
- module ActiveRecordHelper; end
- class InstanceTag; end
- end
-end
-
-
-# Must set before requiring generator libs.
-if defined?(RAILS_ROOT)
- RAILS_ROOT.replace "#{File.dirname(__FILE__)}/fixtures"
-else
- RAILS_ROOT = "#{File.dirname(__FILE__)}/fixtures"
-end
-
-$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
-require 'initializer'
-
-# Mocks out the configuration
-module Rails
- def self.configuration
- Rails::Configuration.new
- end
-end
-
-require 'rails_generator'
-
-#class RailsGeneratorTest < Test::Unit::TestCase
-# BUILTINS = %w(controller integration_test mailer migration model observer plugin resource scaffold session_migration)
-# CAPITALIZED_BUILTINS = BUILTINS.map { |b| b.capitalize }
-
-# def setup
-# ActiveRecord::Base.pluralize_table_names = true
-# @initializer = Rails::Initializer.default
-# @initializer.config = Rails.configuration
-# @initializer.run(:set_root_path)
-# end
-
-# def test_sources
-# expected = [:lib, :vendor,
-# "plugins (vendor/plugins)".to_sym, # <plugin>/generators and <plugin>/rails_generators
-# :user,
-# :RubyGems, :RubyGems, # gems named <x>_generator, gems containing /rails_generator/ folder
-# :builtin]
-# expected.delete(:RubyGems) unless Object.const_defined?(:Gem)
-# assert_equal expected, Rails::Generator::Base.sources.map { |s| s.label }
-# end
-
-# def test_lookup_builtins
-# (BUILTINS + CAPITALIZED_BUILTINS).each do |name|
-# assert_nothing_raised do
-# spec = Rails::Generator::Base.lookup(name)
-# assert_not_nil spec
-# assert_kind_of Rails::Generator::Spec, spec
-
-# klass = spec.klass
-# assert klass < Rails::Generator::Base
-# assert_equal spec, klass.spec
-# end
-# end
-# end
-
-# def test_autolookup
-# assert_nothing_raised { ControllerGenerator }
-# assert_nothing_raised { ModelGenerator }
-# end
-
-# def test_lookup_missing_generator
-# assert_raise Rails::Generator::GeneratorError do
-# Rails::Generator::Base.lookup('missing').klass
-# end
-# end
-
-# def test_lookup_missing_class
-# spec = nil
-# assert_nothing_raised { spec = Rails::Generator::Base.lookup('missing_class') }
-# assert_not_nil spec
-# assert_kind_of Rails::Generator::Spec, spec
-# assert_raise(NameError) { spec.klass }
-# end
-
-# def test_generator_usage
-# (BUILTINS - ["session_migration"]).each do |name|
-# assert_raise(Rails::Generator::UsageError, "Generator '#{name}' should raise an error without arguments") {
-# Rails::Generator::Base.instance(name)
-# }
-# end
-# end
-
-# def test_generator_spec
-# spec = Rails::Generator::Base.lookup('working')
-# assert_equal 'working', spec.name
-# assert_match(/#{spec.path}$/, "#{RAILS_ROOT}/lib/generators/working")
-# assert_equal :lib, spec.source
-# assert_nothing_raised { assert_match(/WorkingGenerator$/, spec.klass.name) }
-# end
-
-#end