diff options
author | schneems <richard.schneeman@gmail.com> | 2014-05-24 14:28:50 +0200 |
---|---|---|
committer | schneems <richard.schneeman@gmail.com> | 2014-05-26 10:11:07 -0500 |
commit | e83ce84ef991f06d15d66dce27f06e01477b617e (patch) | |
tree | c0bdf6dd5ee7c0d10d5f19665260e37461dd27af /railties/test | |
parent | ec88d6861a81e5d7402660fb141f75f0aab86a4a (diff) | |
download | rails-e83ce84ef991f06d15d66dce27f06e01477b617e.tar.gz rails-e83ce84ef991f06d15d66dce27f06e01477b617e.tar.bz2 rails-e83ce84ef991f06d15d66dce27f06e01477b617e.zip |
print generators on failed generate
Let's say we just ran:
```
$ rails g migrate add_click_to_issue_assignment
```
We will get an error that looks like:
```
Could not find generator migrate.
```
This patch adds all existing migrations to the output to make it easier for a developer to find a valid migration.
```
Could not find generator "migrate". Please select a valid generator:
Rails:
assets
controller
generator
helper
integration_test
mailer
migration
model
resource
scaffold
scaffold_controller
task
```
It would be nice to do some spelling detection and suggest alternatives, but for now this should help.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators_test.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index eac28badfe..8d6dbf80c2 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -21,8 +21,10 @@ class GeneratorsTest < Rails::Generators::TestCase 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 + name = :unknown + output = capture(:stdout){ Rails::Generators.invoke name } + assert_match "Could not find generator '#{name}'", output + assert_match "scaffold", output end def test_help_when_a_generator_with_required_arguments_is_invoked_without_arguments |