fix nijie specs

This commit is contained in:
Albert Yi
2018-09-11 13:26:39 -07:00
parent e58172483b
commit f16c3a3f40
2 changed files with 7 additions and 3 deletions

View File

@@ -41,6 +41,10 @@ module Sources
if x =~ %r!https?://nijie\.info/view_popup\.php.+id=(\d+)!
return "https://nijie.info/view.php?id=#{$1}"
end
if x =~ %r!\Ahttps?://pic\d+\.nijie\.info/nijie_picture/(\d+)!
return "https://nijie.info/view.php?id=#{$1}"
end
end
return super

View File

@@ -154,10 +154,10 @@ class ArtistUrlTest < ActiveSupport::TestCase
should "normalize nijie urls" do
url = FactoryBot.create(:artist_url, url: "https://pic03.nijie.info/nijie_picture/236014_20170620101426_0.png")
assert_equal("http://nijie.info/members.php?id=236014/", url.normalized_url)
assert_equal("http://nijie.info/members.php?id=161703/", url.normalized_url)
url = FactoryBot.create(:artist_url, url: "https://nijie.info/members.php?id=236014")
assert_equal("http://nijie.info/members.php?id=236014/", url.normalized_url)
url = FactoryBot.create(:artist_url, url: "https://nijie.info/members.php?id=161703")
assert_equal("http://nijie.info/members.php?id=161703/", url.normalized_url)
end
end
end