diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-12-10 14:42:10 +0100 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2010-12-16 01:49:28 +0530 |
commit | e6928e8c35bfc22425916f334e9482f955bc8907 (patch) | |
tree | 8e2b6d98cad03e3f0141f3975c88c5bd0e6cfa8a /railties/test/generators | |
parent | 692b621d2a134ac784719abcb4fd24f1710cd786 (diff) | |
download | rails-e6928e8c35bfc22425916f334e9482f955bc8907.tar.gz rails-e6928e8c35bfc22425916f334e9482f955bc8907.tar.bz2 rails-e6928e8c35bfc22425916f334e9482f955bc8907.zip |
Allow to generate namespaced generators [#6140 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/generator_generator_test.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb index 26f975a191..f4c975fc18 100644 --- a/railties/test/generators/generator_generator_test.rb +++ b/railties/test/generators/generator_generator_test.rb @@ -17,4 +17,43 @@ class GeneratorGeneratorTest < Rails::Generators::TestCase assert_file "lib/generators/awesome/awesome_generator.rb", /class AwesomeGenerator < Rails::Generators::NamedBase/ end + + def test_namespaced_generator_skeleton + run_generator ["rails/awesome"] + + %w( + lib/generators/rails/awesome + lib/generators/rails/awesome/USAGE + lib/generators/rails/awesome/templates + ).each{ |path| assert_file path } + + assert_file "lib/generators/rails/awesome/awesome_generator.rb", + /class Rails::AwesomeGenerator < Rails::Generators::NamedBase/ + end + + def test_generator_skeleton_is_created_without_file_name_namespace + run_generator ["awesome", "--namespace", "false"] + + %w( + lib/generators/ + lib/generators/USAGE + lib/generators/templates + ).each{ |path| assert_file path } + + assert_file "lib/generators/awesome_generator.rb", + /class AwesomeGenerator < Rails::Generators::NamedBase/ + end + + def test_namespaced_generator_skeleton_without_file_name_namespace + run_generator ["rails/awesome", "--namespace", "false"] + + %w( + lib/generators/rails + lib/generators/rails/USAGE + lib/generators/rails/templates + ).each{ |path| assert_file path } + + assert_file "lib/generators/rails/awesome_generator.rb", + /class Rails::AwesomeGenerator < Rails::Generators::NamedBase/ + end end |