for artist urls, normalize https

This commit is contained in:
albert
2013-02-21 16:13:06 -05:00
parent 19398df28e
commit d16a240eda
4 changed files with 13 additions and 0 deletions

View File

@@ -94,10 +94,13 @@ class ArtistTest < ActiveSupport::TestCase
should "find matches by url" do
a1 = FactoryGirl.create(:artist, :name => "rembrandt", :url_string => "http://rembrandt.com/test.jpg")
a2 = FactoryGirl.create(:artist, :name => "subway", :url_string => "http://subway.com/test.jpg")
a3 = FactoryGirl.create(:artist, :name => "minko", :url_string => "https://minko.com/test.jpg")
assert_equal(["rembrandt"], Artist.find_all_by_url("http://rembrandt.com/test.jpg").map(&:name))
assert_equal(["rembrandt"], Artist.find_all_by_url("http://rembrandt.com/another.jpg").map(&:name))
assert_equal([], Artist.find_all_by_url("http://nonexistent.com/test.jpg").map(&:name))
assert_equal(["minko"], Artist.find_all_by_url("https://minko.com/test.jpg").map(&:name))
assert_equal(["minko"], Artist.find_all_by_url("http://minko.com/test.jpg").map(&:name))
end
should "not allow duplicates" do

View File

@@ -22,6 +22,12 @@ class ArtistUrlTest < ActiveSupport::TestCase
assert_equal("http://monet.com/", url.url)
assert_equal("http://monet.com/", url.normalized_url)
end
should "normalise https" do
url = FactoryGirl.create(:artist_url, :url => "https://google.com")
assert_equal("https://google.com", url.url)
assert_equal("http://google.com/", url.normalized_url)
end
should "normalize fc2 urls" do
url = FactoryGirl.create(:artist_url, :url => "http://blog55.fc2.com/monet")