aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-11-03 20:50:39 -0200
committerJeremy Kemper <jeremy@bitsweat.net>2009-11-03 16:32:47 -0800
commite15b5eda2b4888764cd0c63a297136babac026d3 (patch)
tree065ceaf8dbe7e3007fc31524375003321f13c40b /railties/test
parentf950d0b4af54c3d387024dce2c5e2bc56aef0fc3 (diff)
downloadrails-e15b5eda2b4888764cd0c63a297136babac026d3.tar.gz
rails-e15b5eda2b4888764cd0c63a297136babac026d3.tar.bz2
rails-e15b5eda2b4888764cd0c63a297136babac026d3.zip
Avoid duplicated names on help description and show proper error message if trying to load a Rails 2.x generator.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/fixtures/lib/generators/foobar/foobar_generator.rb4
-rw-r--r--railties/test/generators_test.rb11
2 files changed, 13 insertions, 2 deletions
diff --git a/railties/test/fixtures/lib/generators/foobar/foobar_generator.rb b/railties/test/fixtures/lib/generators/foobar/foobar_generator.rb
new file mode 100644
index 0000000000..d1de8c56fa
--- /dev/null
+++ b/railties/test/fixtures/lib/generators/foobar/foobar_generator.rb
@@ -0,0 +1,4 @@
+module Foobar
+ class FoobarGenerator < Rails::Generators::Base
+ end
+end
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb
index 8f1984c7d2..07f51eca01 100644
--- a/railties/test/generators_test.rb
+++ b/railties/test/generators_test.rb
@@ -45,6 +45,12 @@ class GeneratorsTest < GeneratorsTestCase
assert_equal "test_unit:generators:model", klass.namespace
end
+ def test_find_by_namespace_with_duplicated_name
+ klass = Rails::Generators.find_by_namespace(:foobar)
+ assert klass
+ assert_equal "foobar:foobar", klass.namespace
+ end
+
def test_find_by_namespace_add_generators_to_raw_lookups
klass = Rails::Generators.find_by_namespace("test_unit:model")
assert klass
@@ -101,14 +107,15 @@ class GeneratorsTest < GeneratorsTestCase
def test_rails_generators_with_others_information
output = capture(:stdout){ Rails::Generators.help }.split("\n").last
- assert_equal "Others: active_record:fixjour, fixjour, mspec, rails:javascripts.", output
+ assert_equal "Others: active_record:fixjour, fixjour, foobar, mspec, rails:javascripts.", output
end
def test_warning_is_shown_if_generator_cant_be_loaded
Rails::Generators.load_paths << File.join(Rails.root, "vendor", "gems", "gems", "wrong")
output = capture(:stderr){ Rails::Generators.find_by_namespace(:wrong) }
+
assert_match /\[WARNING\] Could not load generator at/, output
- assert_match /Error: uninitialized constant Rails::Generator/, output
+ assert_match /Rails 2\.x generator/, output
end
def test_no_color_sets_proper_shell