1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test/command/spellchecker_test.rb
Genadi Samokovarov cb25f2c989 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.
2018-03-23 11:36:03 +02:00

10 lines
317 B
Ruby

# frozen_string_literal: true
require "abstract_unit"
require "rails/command/spellchecker"
class Rails::Command::SpellcheckerTest < ActiveSupport::TestCase
test "suggests a word correction from dictionary" do
assert_equal "thin", Rails::Command::Spellchecker.suggest("tin", from: %w(puma thin cgi))
end
end