Skip to content

Commit e492a67

Browse files
committed
Add test_did_you_mean
1 parent 5945770 commit e492a67

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/test_rdoc_ri_driver.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,27 @@ def test_find_store
969969
assert_equal 'nonexistent', e.name
970970
end
971971

972+
def test_did_you_mean
973+
skip 'skip test with did_you_men' unless defined? DidYouMean::SpellChecker
974+
975+
util_ancestors_store
976+
977+
e = assert_raises RDoc::RI::Driver::NotFoundError do
978+
@driver.lookup_method 'Foo.i_methdo'
979+
end
980+
assert_equal "Nothing known about Foo.i_methdo\nDid you mean? i_method", e.message
981+
982+
e = assert_raises RDoc::RI::Driver::NotFoundError do
983+
@driver.lookup_method 'Foo#i_methdo'
984+
end
985+
assert_equal "Nothing known about Foo#i_methdo\nDid you mean? i_method", e.message
986+
987+
e = assert_raises RDoc::RI::Driver::NotFoundError do
988+
@driver.lookup_method 'Foo::i_methdo'
989+
end
990+
assert_equal "Nothing known about Foo::i_methdo\nDid you mean? c_method", e.message
991+
end
992+
972993
def test_formatter
973994
tty = Object.new
974995
def tty.tty?() true; end

0 commit comments

Comments
 (0)