artist urls: normalize trailing slashes and missing http://.

* Remove unnecessary trailing slashes when artist URLs are saved.
* Automatically add `http://` to new artist URLs if it's missing (before
  this was an error; now it's automatically fixed).
This commit is contained in:
evazion
2022-02-21 18:57:40 -06:00
parent 7d49ab6130
commit c5777f360e
3 changed files with 18 additions and 19 deletions

View File

@@ -580,7 +580,8 @@ class ArtistTest < ActiveSupport::TestCase
should "not save invalid urls" do
assert_no_difference("ArtistVersion.count") do
@artist.update(:url_string => "http://foo.com www.example.com")
@artist.update(url_string: "http://foo.com :42")
assert_equal(%w[http://foo.com], @artist.versions.last.urls)
end
end