From c6ef45d6c4e718b306ba8309e15ee5c1fb532878 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Fri, 3 Feb 2012 09:17:59 -0200 Subject: Add convenience method to hide a generator from the available ones It is usually useful to be able to hide a generator when running rails generate command. Such generators might be used only to dry up generators code and shouldn't be available to end users. --- railties/test/generators_test.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'railties/test/generators_test.rb') diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 5f9ee220dc..60e7e57a91 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -201,10 +201,16 @@ class GeneratorsTest < Rails::Generators::TestCase mspec = Rails::Generators.find_by_namespace :fixjour assert mspec.source_paths.include?(File.join(Rails.root, "lib", "templates", "fixjour")) end - + def test_usage_with_embedded_ruby require File.expand_path("fixtures/lib/generators/usage_template/usage_template_generator", File.dirname(__FILE__)) output = capture(:stdout) { Rails::Generators.invoke :usage_template, ['--help'] } assert_match /:: 2 ::/, output end + + def test_hide_namespace + assert !Rails::Generators.hidden_namespaces.include?("special:namespace") + Rails::Generators.hide_namespace("special:namespace") + assert Rails::Generators.hidden_namespaces.include?("special:namespace") + end end -- cgit v1.2.3