diff --git a/lib/did_you_mean.rb b/lib/did_you_mean.rb index acd82dea..5824797b 100644 --- a/lib/did_you_mean.rb +++ b/lib/did_you_mean.rb @@ -1,6 +1,5 @@ require "did_you_mean/version" require "did_you_mean/core_ext/name_error" -require "did_you_mean/core_ext/rake_task_manager" require "did_you_mean/spell_checker" require 'did_you_mean/spell_checkers/name_error_checkers' diff --git a/lib/did_you_mean/core_ext/rake_task_manager.rb b/lib/did_you_mean/core_ext/rake_task_manager.rb deleted file mode 100644 index 1330e8c9..00000000 --- a/lib/did_you_mean/core_ext/rake_task_manager.rb +++ /dev/null @@ -1,22 +0,0 @@ -module DidYouMean - module CorrectableRakeTaskManager - def [](task_name, scopes = nil) - super - rescue RuntimeError => error - begin - suggestions = ::DidYouMean::SpellChecker.new(dictionary: @tasks.keys).correct(task_name.to_s) - message = ::DidYouMean::Formatter.new(suggestions).to_s - - raise error, (error.to_s << message), error.backtrace - rescue - raise error, error.to_s, error.backtrace - end - end - end -end - -begin - require 'rake/application' - Rake::Application.prepend DidYouMean::CorrectableRakeTaskManager -rescue LoadError -end diff --git a/test/spell_checking/rake_task_name_test.rb b/test/spell_checking/rake_task_name_test.rb deleted file mode 100644 index 0d22f2cc..00000000 --- a/test/spell_checking/rake_task_name_test.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'rake' -require 'test_helper' - -class RakeTaskNameTest < Minitest::Test - def setup - Rake.application.in_namespace 'db' do - Rake::Task.define_task(:drop) - Rake::Task.define_task(:create) - Rake::Task.define_task(:migrate) - end - end - - def teardown - Rake::Task.clear - end - - def test_corrections_include_instance_method - error = assert_raises(RuntimeError) do - Rake::Task['db:mirgate'] - end - - assert_match "Did you mean? db:migrate", error.to_s - end -end