nijie: don't return bogus artists when artist finder finds no match.
This commit is contained in:
@@ -49,6 +49,7 @@ class Artist < ApplicationRecord
|
||||
break if url =~ /deviantart\.net\//i
|
||||
break if url =~ %r!\Ahttps?://(?:mobile\.)?twitter\.com/\Z!i
|
||||
break if url =~ %r!pawoo\.net/(?:web/)?$!i
|
||||
break if url =~ %r!\Ahttps?://(pic\d+\.)?nijie\.info/!i
|
||||
end
|
||||
|
||||
artists.inject({}) {|h, x| h[x.name] = x; h}.values.slice(0, 20)
|
||||
|
||||
@@ -310,6 +310,22 @@ class ArtistTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "when finding nijie artists" do
|
||||
setup do
|
||||
FactoryGirl.create(:artist, :name => "evazion", :url_string => "http://nijie.info/members.php?id=236014")
|
||||
FactoryGirl.create(:artist, :name => "728995", :url_string => "http://nijie.info/members.php?id=728995")
|
||||
end
|
||||
|
||||
should "find the artist" do
|
||||
assert_artist_found("evazion", "http://nijie.info/view.php?id=218944")
|
||||
assert_artist_found("728995", "http://nijie.info/view.php?id=213043")
|
||||
end
|
||||
|
||||
should "return nothing for unknown nijie artists" do
|
||||
assert_artist_not_found("http://nijie.info/view.php?id=157953")
|
||||
end
|
||||
end
|
||||
|
||||
should "normalize its other names" do
|
||||
artist = FactoryGirl.create(:artist, :name => "a1", :other_names_comma => "aaa, bbb, ccc ddd")
|
||||
assert_equal("aaa, bbb, ccc_ddd", artist.other_names_comma)
|
||||
|
||||
Reference in New Issue
Block a user