diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-03 12:01:29 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-03 17:14:48 +0100 |
commit | 6716e4bc0c201d9375fa07b44c1a96b6948fc6ab (patch) | |
tree | 897b19a1ed5dea94a631d77e2ce8a47bf58e601e /railties/test/generators_test.rb | |
parent | 00f3f6dc3145f2d7e8b8dadd966008cd0fa54636 (diff) | |
download | rails-6716e4bc0c201d9375fa07b44c1a96b6948fc6ab.tar.gz rails-6716e4bc0c201d9375fa07b44c1a96b6948fc6ab.tar.bz2 rails-6716e4bc0c201d9375fa07b44c1a96b6948fc6ab.zip |
Use regexp in lookups instead of traversing namespaces. This removes the need of special cases.
Diffstat (limited to 'railties/test/generators_test.rb')
-rw-r--r-- | railties/test/generators_test.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 4b7b80c7f5..2df218debc 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -9,6 +9,11 @@ class GeneratorsTest < GeneratorsTestCase Gem.stubs(:respond_to?).with(:loaded_specs).returns(false) end + def test_invoke_add_generators_to_raw_lookups + TestUnit::Generators::ModelGenerator.expects(:start).with(["Account"], {}) + Rails::Generators.invoke("test_unit:model", ["Account"]) + end + def test_invoke_when_generator_is_not_found output = capture(:stdout){ Rails::Generators.invoke :unknown } assert_equal "Could not find generator unknown.\n", output @@ -51,12 +56,6 @@ class GeneratorsTest < GeneratorsTestCase 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 - assert_equal "test_unit:generators:model", klass.namespace - end - def test_find_by_namespace_lookup_to_the_rails_root_folder klass = Rails::Generators.find_by_namespace(:fixjour) assert klass @@ -96,7 +95,7 @@ class GeneratorsTest < GeneratorsTestCase end def test_builtin_generators - assert Rails::Generators.builtin.include? %w(rails model) + assert Rails::Generators.builtin.include?("rails:model") end def test_rails_generators_help_with_builtin_information @@ -107,7 +106,7 @@ 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, foobar, mspec, rails:javascripts.", output + assert_equal "Others: active_record:fixjour, fixjour, foobar:foobar, mspec, rails:javascripts, xspec.", output end def test_warning_is_shown_if_generator_cant_be_loaded @@ -178,6 +177,8 @@ class GeneratorsTest < GeneratorsTestCase end assert_equal false, klass.class_options[:generate].default + ensure + Rails::Generators.subclasses.delete(klass) end def test_source_paths_for_not_namespaced_generators |