Merge branch 'master' into fix-pixiv-profile-url

This commit is contained in:
evazion
2020-06-24 00:06:55 -05:00
committed by GitHub
103 changed files with 1639 additions and 2247 deletions

View File

@@ -15,10 +15,7 @@ module Sources
def get_source(source)
@site = Sources::Strategies.find(source)
@site
rescue Net::OpenTimeout
skip "Remote connection to #{source} failed"
end
context "in all cases" do
@@ -73,17 +70,6 @@ module Sources
end
end
context "A https://www.pixiv.net/fanbox/creator/*/post/* source" do
should_eventually "work" do
@site = Sources::Strategies.find("http://www.pixiv.net/fanbox/creator/554149/post/82555")
assert_equal("TYONE(お仕事募集中)", @site.artist_name)
assert_equal("https://www.pixiv.net/users/554149", @site.profile_url)
assert_equal("https://fanbox.pixiv.net/images/post/82555/Lyyeb6dDLcQZmy09nqLZapuS.jpeg", @site.image_url)
assert_nothing_raised { @site.to_h }
end
end
context "A https://www.pixiv.net/*/artworks/* source" do
should "work" do
@site = Sources::Strategies.find("https://www.pixiv.net/en/artworks/64476642")
@@ -249,6 +235,10 @@ module Sources
assert_includes(@translated_tags, "foo")
end
should "not translate tags for digital media" do
assert_equal(false, @tags.include?("Photoshop"))
end
should "normalize 10users入り tags" do
assert_includes(@tags, "風景10users入り")
assert_includes(@translated_tags, "scenery")
@@ -280,7 +270,7 @@ module Sources
should "not translate '1000users入り' to '1'" do
FactoryBot.create(:tag, name: "1", post_count: 1)
source = get_source("https://www.pixiv.net/member_illust.php?mode=medium&illust_id=60665428")
tags = %w[1000users入り Fate/GrandOrder アルジュナ(Fate) アルトリア・ペンドラゴン イシュタル(Fate) グランブルーファンタジー マシュ・キリエライト マーリン(Fate) 両儀式 手袋 CLIP\ STUDIO\ PAINT Photoshop]
tags = %w[1000users入り Fate/GrandOrder アルジュナ(Fate) アルトリア・ペンドラゴン イシュタル(Fate) グランブルーファンタジー マシュ・キリエライト マーリン(Fate) 両儀式 手袋]
assert_equal(tags.sort, source.tags.map(&:first).sort)
assert_equal(["fate/grand_order"], source.translated_tags.map(&:name))