This commit is contained in:
Justin Kenyon 2020-04-06 21:28:56 -04:00
Родитель 0c17bc2f91
Коммит 556de44a9d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4D7E4DB22538E93E
1 изменённых файлов: 24 добавлений и 4 удалений

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

@ -44,7 +44,7 @@ describe "collections" do
items_for_collection(collection).each do |item|
next unless item.match?(USERNAME_AND_REPO_REGEX)
unless client.repository?(item)
unless repository_exists?(item)
errors << "#{collection}: #{item} does not exist or is private"
end
end
@ -58,7 +58,7 @@ describe "collections" do
items_for_collection(collection).each do |item|
next unless item.match?(USERNAME_REGEX)
errors << "#{collection}: #{item} does not exist" unless client.user(item).present?
errors << "#{collection}: #{item} does not exist" unless user_exists?(item)
end
assert_empty errors
@ -71,9 +71,9 @@ describe "collections" do
next unless item.match?(USERNAME_AND_REPO_REGEX) || item.match?(USERNAME_REGEX)
if item.match?(USERNAME_AND_REPO_REGEX)
errors << "#{collection}: #{item} has been renamed" unless client.repository?(item)
errors << "#{collection}: #{item} has been renamed" unless repository_exists?(item)
else
errors << "#{collection}: #{item} has been renamed" unless client.user(item)
errors << "#{collection}: #{item} has been renamed" unless user_exists?(item)
end
end
@ -176,4 +176,24 @@ describe "collections" do
end
end
end
def repository_exists?(item)
@repos ||= {}
if @repos.key?(item)
@repos[item]
else
@repos[item] = client.repository?(item)
end
end
def user_exists?(item)
@users ||= {}
if @users.key?(item)
@users[item]
else
@users[item] = client.user(item).present?
end
end
end