aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators_test.rb
diff options
context:
space:
mode:
authorGenadi Samokovarov <gsamokovarov@gmail.com>2018-03-17 15:55:44 +0200
committerGenadi Samokovarov <gsamokovarov@gmail.com>2018-03-23 11:36:03 +0200
commitcb25f2c989588edf77f978820196b4446e01ffe8 (patch)
tree0dd189e6496b065194ec99a04b5c3e3651449031 /railties/test/generators_test.rb
parentef73318e29666786feb00e9e9b3b49a771bb0b73 (diff)
downloadrails-cb25f2c989588edf77f978820196b4446e01ffe8.tar.gz
rails-cb25f2c989588edf77f978820196b4446e01ffe8.tar.bz2
rails-cb25f2c989588edf77f978820196b4446e01ffe8.zip
Use `did_you_mean` spell checker for option suggestions
Now that we require Ruby over `2.3`, we can replace the current suggestion methods we have with tooling from the `did_you_mean` gem. There is a small user visible change and this is that we now offer a single suggestion for misspelled options. We are suggesting fixes during generator invocation and during a mistyped rails server rack handler. In both cases, if we don't make a proper prediction on the first match, we won't do so in the second or third one, so in my mind, this is okay.
Diffstat (limited to 'railties/test/generators_test.rb')
-rw-r--r--railties/test/generators_test.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb
index 9f1f2a2289..a16a2d3f0a 100644
--- a/railties/test/generators_test.rb
+++ b/railties/test/generators_test.rb
@@ -33,7 +33,7 @@ class GeneratorsTest < Rails::Generators::TestCase
def test_generator_suggestions
name = :migrationz
output = capture(:stdout) { Rails::Generators.invoke name }
- assert_match "Maybe you meant 'migration'", output
+ assert_match 'Maybe you meant "migration"?', output
end
def test_generator_suggestions_except_en_locale
@@ -43,7 +43,7 @@ class GeneratorsTest < Rails::Generators::TestCase
I18n.default_locale = :ja
name = :tas
output = capture(:stdout) { Rails::Generators.invoke name }
- assert_match "Maybe you meant 'task', 'job' or", output
+ assert_match 'Maybe you meant "task"?', output
ensure
I18n.available_locales = orig_available_locales
I18n.default_locale = orig_default_locale
@@ -52,7 +52,7 @@ class GeneratorsTest < Rails::Generators::TestCase
def test_generator_multiple_suggestions
name = :tas
output = capture(:stdout) { Rails::Generators.invoke name }
- assert_match "Maybe you meant 'task', 'job' or", output
+ assert_match 'Maybe you meant "task"?', output
end
def test_help_when_a_generator_with_required_arguments_is_invoked_without_arguments