Artist urls can be prepended with a '-' to mark is inactive (#3388)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user