Commit 63ab6374 authored by Albert Yi's avatar Albert Yi

potential fix for #3727

parent c97b0245
......@@ -2,7 +2,7 @@ class ArtistUrl < ApplicationRecord
before_validation :parse_prefix
before_save :initialize_normalized_url, on: [ :create ]
before_save :normalize
validates :url, presence: true, uniqueness: true
validates :url, presence: true, uniqueness: { scope: :artist_id }
validate :validate_url_format
belongs_to :artist, :touch => true
......
......@@ -4,7 +4,6 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest
def assert_artist_found(expected_artist, source_url = nil)
if source_url
get_auth finder_artists_path(format: "json", url: source_url), @user
puts response.body
if response.body =~ /Net::OpenTimeout/
skip "Remote connection to #{source_url} failed"
return
......@@ -134,7 +133,7 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest
context "with an artist that has notes" do
setup do
as(@admin) do
@artist = create(:artist, name: "aaa", notes: "testing")
@artist = create(:artist, name: "aaa", notes: "testing", url_string: "htttp://example.com")
end
@wiki_page = @artist.wiki_page
@another_user = create(:user)
......@@ -143,7 +142,7 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest
should "update an artist" do
old_timestamp = @wiki_page.updated_at
travel_to(1.minute.from_now) do
put_auth artist_path(@artist.id), @user, params: {artist: {notes: "rex"}}
put_auth artist_path(@artist.id), @user, params: {artist: {notes: "rex", url_string: "http://example.com\nhttp://monet.com"}}
end
@artist.reload
@wiki_page = @artist.wiki_page
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment