add support for nico seiga manga (fixes #4060)

This commit is contained in:
Albert Yi
2019-02-25 14:44:45 -08:00
parent 78322b38f4
commit 90ce42a537
7 changed files with 201 additions and 34 deletions

View File

@@ -0,0 +1,23 @@
require 'test_helper'
module Sources
class NicoSeigaTest < ActiveSupport::TestCase
context "The source site for nico seiga" do
setup do
@site = Sources::Strategies.find("http://seiga.nicovideo.jp/watch/mg316708", "http://seiga.nicovideo.jp/watch/mg316708")
end
should "find the image urls" do
assert_equal(["https://seiga.nicovideo.jp/image/source/8100968", "https://seiga.nicovideo.jp/image/source/8100969", "https://seiga.nicovideo.jp/image/source/8100970", "https://seiga.nicovideo.jp/image/source/8100971", "https://seiga.nicovideo.jp/image/source/8100972", "https://seiga.nicovideo.jp/image/source/8100973", "https://seiga.nicovideo.jp/image/source/8100974", "https://seiga.nicovideo.jp/image/source/8100975"], @site.image_urls)
end
should "find the page url" do
assert_equal("http://seiga.nicovideo.jp/watch/mg316708", @site.page_url)
end
should "find the artist name" do
assert_not_nil(@site.artist_name)
end
end
end
end

View File

@@ -6,6 +6,7 @@ module Sources
setup do
@site_1 = Sources::Strategies.find("http://lohas.nicoseiga.jp/o/910aecf08e542285862954017f8a33a8c32a8aec/1433298801/4937663")
@site_2 = Sources::Strategies.find("http://seiga.nicovideo.jp/seiga/im4937663")
@site_3 = Sources::Strategies.find("http://seiga.nicovideo.jp/watch/mg376206")
end
should "get the profile" do
@@ -59,6 +60,12 @@ module Sources
assert_match(full_image_url, site.image_url)
assert_match(full_image_url, site.canonical_url)
end
context "for a manga page" do
should "not try to find the image url" do
assert_nil(@site_3.image_url)
end
end
end
end
end