diff options
Diffstat (limited to 'railties/test/generators_test.rb')
-rw-r--r-- | railties/test/generators_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index f93800a5ae..99c9d790eb 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -94,6 +94,14 @@ class GeneratorsTest < Rails::Generators::TestCase assert_match /Rails 2\.x generator/, output end + def test_invoke_with_nested_namespaces + model_generator = mock('ModelGenerator') do + expects(:start).with(["Account"], {}) + end + Rails::Generators.expects(:find_by_namespace).with('namespace', 'my:awesome').returns(model_generator) + Rails::Generators.invoke 'my:awesome:namespace', ["Account"] + end + def test_rails_generators_help_with_builtin_information output = capture(:stdout){ Rails::Generators.help } assert_match /Rails:/, output @@ -102,6 +110,12 @@ class GeneratorsTest < Rails::Generators::TestCase assert_no_match /^ app$/, output end + def test_rails_generators_help_does_not_include_app_nor_plugin_new + output = capture(:stdout){ Rails::Generators.help } + assert_no_match /app/, output + assert_no_match /plugin_new/, output + end + def test_rails_generators_with_others_information output = capture(:stdout){ Rails::Generators.help } assert_match /Fixjour:/, output @@ -114,6 +128,16 @@ class GeneratorsTest < Rails::Generators::TestCase assert_match /^ active_record:fixjour$/, output end + def test_default_banner_should_show_generator_namespace + klass = Rails::Generators.find_by_namespace(:foobar) + assert_match /^rails generate foobar:foobar/, klass.banner + end + + def test_default_banner_should_not_show_rails_generator_namespace + klass = Rails::Generators.find_by_namespace(:model) + assert_match /^rails generate model/, klass.banner + end + def test_no_color_sets_proper_shell Rails::Generators.no_color! assert_equal Thor::Shell::Basic, Thor::Base.shell |