mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Doc fix (closes #9203) [lazyatom]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7551 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
ac4f37ecbb
commit
c361caf8b4
2 changed files with 16 additions and 8 deletions
|
@ -92,9 +92,13 @@ module Rails
|
|||
# 1. Rails application. If RAILS_ROOT is defined we know we're
|
||||
# generating in the context of a Rails application, so search
|
||||
# RAILS_ROOT/generators.
|
||||
# 2. User home directory. Search ~/.rails/generators.
|
||||
# 3. RubyGems. Search for gems named *_generator.
|
||||
# 4. Builtins. Model, controller, mailer, scaffold.
|
||||
# 2. Look in plugins, either for generators/ or rails_generators/
|
||||
# directories within each plugin
|
||||
# 3. User home directory. Search ~/.rails/generators.
|
||||
# 4. RubyGems. Search for gems named *_generator, and look for
|
||||
# generators within any RubyGem's
|
||||
# /rails_generators/<generator_name>_generator.rb file.
|
||||
# 5. Builtins. Model, controller, mailer, scaffold, and so on.
|
||||
def use_component_sources!
|
||||
reset_sources
|
||||
if defined? ::RAILS_ROOT
|
||||
|
|
|
@ -37,7 +37,7 @@ require 'rails_generator'
|
|||
|
||||
|
||||
class RailsGeneratorTest < Test::Unit::TestCase
|
||||
BUILTINS = %w(controller mailer model scaffold)
|
||||
BUILTINS = %w(controller integration_test mailer migration model observer plugin resource scaffold session_migration web_service)
|
||||
CAPITALIZED_BUILTINS = BUILTINS.map { |b| b.capitalize }
|
||||
|
||||
def setup
|
||||
|
@ -45,8 +45,12 @@ class RailsGeneratorTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_sources
|
||||
expected = [:lib, :vendor, :plugins, :user, :RubyGems, :builtin]
|
||||
expected.delete(:gem) unless Object.const_defined?(:Gem)
|
||||
expected = [:lib, :vendor,
|
||||
:plugins, :plugins, # <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
|
||||
|
||||
|
@ -84,8 +88,8 @@ class RailsGeneratorTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_generator_usage
|
||||
BUILTINS.each do |name|
|
||||
assert_raise(Rails::Generator::UsageError) {
|
||||
(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
|
||||
|
|
Loading…
Reference in a new issue