From fb173b66138adf1d6940aca3af76d3c62307441d Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" <yuuji.yaginuma@gmail.com> Date: Sat, 29 Dec 2018 18:57:55 +0900 Subject: Do not show suggestion message when not exist suggestion **before** ``` $ ./bin/rails g g Could not find generator 'g'. Maybe you meant nil? Run `rails generate --help` for more options. ``` **after** ``` $ ./bin/rails g g Could not find generator 'g'. Run `rails generate --help` for more options. ``` --- railties/test/commands/server_test.rb | 6 ++++++ railties/test/generators_test.rb | 1 + 2 files changed, 7 insertions(+) (limited to 'railties/test') diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb index fbdd3f3ebb..25b89ecbd8 100644 --- a/railties/test/commands/server_test.rb +++ b/railties/test/commands/server_test.rb @@ -32,6 +32,12 @@ class Rails::Command::ServerCommandTest < ActiveSupport::TestCase assert_match(/Could not find server "tin". Maybe you meant "thin"?/, run_command("--using", "tin")) end + def test_using_server_mistype_without_suggestion + output = run_command("--using", "t") + assert_match(/Could not find server "t"/, output) + assert_no_match(/Maybe you meant/, output) + end + def test_using_positional_argument_deprecation assert_match(/DEPRECATION WARNING/, run_command("tin")) end diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index f98c1f78f7..abdc04a8d3 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -28,6 +28,7 @@ class GeneratorsTest < Rails::Generators::TestCase output = capture(:stdout) { Rails::Generators.invoke name } assert_match "Could not find generator '#{name}'", output assert_match "`rails generate --help`", output + assert_no_match "Maybe you meant", output end def test_generator_suggestions -- cgit v1.2.3