Merge pull request #5285 from nonamethanks/tests

Rewrite the tests for various source strategies
This commit is contained in:
N. Oname
2022-10-23 18:05:54 +02:00
committed by GitHub
12 changed files with 610 additions and 900 deletions

View File

@@ -48,7 +48,7 @@ class Source::Extractor
def tags
api_response[:tags].to_a.map do |tag|
[tag, "https://www.artstation.com/search?q=" + CGI.escape(tag)]
[tag, "https://www.artstation.com/search?q=#{CGI.escape(tag)}"]
end
end
@@ -94,7 +94,7 @@ class Source::Extractor
image_sizes = %w[original 4k large medium small]
urls = image_sizes.map { |size| parsed_url.full_image_url(size) }
chosen_url = urls.find { |url| http_exists?(url) }
chosen_url = urls.find { |u| http_exists?(u) }
chosen_url || url
end
end

View File

@@ -52,7 +52,7 @@ class Source::Extractor
end
def artist_name
api_response.account_name
api_response.account_name || artist_name_from_url
end
def artist_name_from_url
@@ -60,7 +60,7 @@ class Source::Extractor
end
def other_names
[api_response.display_name]
[api_response.display_name].compact
end
def account_id