Artist urls can be prepended with a '-' to mark is inactive (#3388)

This commit is contained in:
Albert Yi
2018-05-16 15:33:32 -07:00
parent 6acaf999a1
commit fcd80b6043
7 changed files with 52 additions and 6 deletions

View File

@@ -29,6 +29,12 @@ class ArtistTest < ActiveSupport::TestCase
CurrentUser.ip_addr = nil
end
should "parse inactive urls" do
@artist = Artist.create(name: "blah", url_string: "-http://monet.com")
assert_equal(["-http://monet.com"], @artist.urls.map(&:to_s))
refute(@artist.urls[0].is_active?)
end
should "should have a valid name" do
@artist = Artist.new(:name => "-blah")
@artist.save

View File

@@ -12,6 +12,13 @@ class ArtistUrlTest < ActiveSupport::TestCase
CurrentUser.ip_addr = nil
end
should "allow urls to be marked as inactive" do
url = FactoryBot.create(:artist_url, :url => "-http://monet.com")
assert_equal("http://monet.com", url.url)
assert_equal("http://monet.com/", url.normalized_url)
refute(url.is_active?)
end
should "always add a trailing slash when normalized" do
url = FactoryBot.create(:artist_url, :url => "http://monet.com")
assert_equal("http://monet.com", url.url)