[rubygems/rubygems] [tests] Don't expect suggestions that aren't actually helpful.

https://github.com/rubygems/rubygems/commit/e7d6b92e31
This commit is contained in:
Ellen Marie Dash 2024-09-28 14:57:59 -04:00 коммит произвёл git
Родитель 47a3482a41
Коммит 5c18b63d00
2 изменённых файлов: 6 добавлений и 9 удалений

Просмотреть файл

@ -493,7 +493,6 @@ class TestGemCommandsExecCommand < Gem::TestCase
assert_equal 2, e.exit_code assert_equal 2, e.exit_code
assert_equal <<~ERR, @ui.error assert_equal <<~ERR, @ui.error
ERROR: Could not find a valid gem 'a' (= 2) in any repository ERROR: Could not find a valid gem 'a' (= 2) in any repository
ERROR: Possible alternatives: a
ERR ERR
end end
end end
@ -574,7 +573,6 @@ class TestGemCommandsExecCommand < Gem::TestCase
assert_include @ui.output, "a (= 2) not available locally" assert_include @ui.output, "a (= 2) not available locally"
assert_equal <<~ERROR, @ui.error assert_equal <<~ERROR, @ui.error
ERROR: Could not find a valid gem 'a' (= 2) in any repository ERROR: Could not find a valid gem 'a' (= 2) in any repository
ERROR: Possible alternatives: a
ERROR ERROR
end end
end end
@ -769,8 +767,7 @@ class TestGemCommandsExecCommand < Gem::TestCase
assert_raise Gem::MockGemUi::TermError do assert_raise Gem::MockGemUi::TermError do
invoke "a" invoke "a"
end end
assert_equal "ERROR: Could not find a valid gem 'a' (>= 0) in any repository\n" \ assert_equal "ERROR: Could not find a valid gem 'a' (>= 0) in any repository\n", @ui.error
"ERROR: Possible alternatives: a\n", @ui.error
assert_empty @ui.output assert_empty @ui.output
assert_empty @installed_specs assert_empty @installed_specs
end end

Просмотреть файл

@ -168,20 +168,20 @@ class TestGemSpecFetcher < Gem::TestCase
def test_suggest_gems_from_name_latest def test_suggest_gems_from_name_latest
spec_fetcher do|fetcher| spec_fetcher do|fetcher|
fetcher.spec "example", 1 fetcher.spec "example", 1
fetcher.spec "other-example", 1 fetcher.spec "an-example", 1
fetcher.spec "examp", 1 fetcher.spec "examp", 1
end end
suggestions = @sf.suggest_gems_from_name("examplw", :latest, 1) suggestions = @sf.suggest_gems_from_name("examplw", :latest, 1)
assert_equal ["example"], suggestions assert_equal ["example"], suggestions
suggestions = @sf.suggest_gems_from_name("other") suggestions = @sf.suggest_gems_from_name("anexample")
assert_equal ["other-example"], suggestions assert_equal ["an-example"], suggestions
suggestions = @sf.suggest_gems_from_name("exam") suggestions = @sf.suggest_gems_from_name("xample")
assert suggestions.any? { ["examp"] } assert suggestions.any? { ["examp"] }
assert suggestions.any? { ["example"] } assert suggestions.any? { ["example"] }
assert suggestions.any? { ["other-example"] } assert suggestions.any? { ["an-example"] }
end end
def test_suggest_gems_from_name_prerelease def test_suggest_gems_from_name_prerelease