fix source tests

This commit is contained in:
r888888888
2017-11-20 12:29:35 -08:00
parent e21f7c14db
commit 9d5e4f969f
6 changed files with 25 additions and 23 deletions

View File

@@ -58,30 +58,30 @@ module Sources
context "fetching source data for a new manga image" do
setup do
get_source("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=46304614")
get_source("https://www.pixiv.net/member_illust.php?mode=medium&illust_id=65981735")
end
should "get the profile" do
assert_equal("http://www.pixiv.net/member.php?id=339253", @site.profile_url)
assert_equal("http://www.pixiv.net/member.php?id=696859", @site.profile_url)
end
should "get the artist name" do
assert_equal("evazion", @site.artist_name)
assert_equal("uroobnad", @site.artist_name)
end
should "get the full size image url" do
assert_equal("https://i.pximg.net/img-original/img/2014/10/02/14/21/39/46304614_p0.gif", @site.image_url)
assert_equal("https://i.pximg.net/img-original/img/2017/11/21/05/12/37/65981735_p0.jpg", @site.image_url)
end
should "get the page count" do
assert_equal(3, @site.image_urls.size)
assert_equal(1, @site.image_urls.size)
end
should "get the tags" do
pixiv_tags = @site.tags.map(&:first)
pixiv_links = @site.tags.map(&:last)
assert_equal(%w[漫画 Fate/GrandOrder foo FOO 風景10users入り 伊19/陸奥 鉛筆], pixiv_tags)
assert_equal(%w[漫画 test], pixiv_tags)
assert_contains(pixiv_links, /search\.php/)
end
@@ -129,10 +129,10 @@ module Sources
context "fetching the commentary" do
should "work when the description is blank" do
get_source("https://www.pixiv.net/member_illust.php?mode=medium&illust_id=46337015")
get_source("https://www.pixiv.net/member_illust.php?mode=medium&illust_id=65981746")
assert_equal("Illustration (PNG) - foo & bar", @site.dtext_artist_commentary_title)
assert_equal("", @site.dtext_artist_commentary_desc)
assert_equal("title", @site.dtext_artist_commentary_title)
assert_equal("desc", @site.dtext_artist_commentary_desc)
end
should "convert illust links and member links to dtext" do
@@ -163,18 +163,18 @@ module Sources
FactoryGirl.create(:wiki_page, title: tag, other_names: other_names)
end
@site = get_source("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=46304614")
@site = get_source("https://www.pixiv.net/member_illust.php?mode=medium&illust_id=65981746")
@tags = @site.tags.map(&:first)
@translated_tags = @site.translated_tags.map(&:first)
end
should "get the original tags" do
assert_equal(%w[漫画 Fate/GrandOrder foo FOO 風景10users入り 伊19/陸奥 鉛筆], @tags)
assert_equal(["test", "風景", "Fate/GrandOrder", "伊19/陸奥", "鉛筆", "風景10users入り", "foo", "FOO"], @tags)
end
should "translate the tag if it matches a wiki other name" do
assert_includes(@tags, "漫画")
assert_includes(@translated_tags, "comic")
assert_includes(@tags, "風景")
assert_includes(@translated_tags, "scenery")
end
should "return the same tag if it doesn't match a wiki other name but it does match a tag" do