potential fix for #3727
This commit is contained in:
@@ -2,7 +2,7 @@ class ArtistUrl < ApplicationRecord
|
|||||||
before_validation :parse_prefix
|
before_validation :parse_prefix
|
||||||
before_save :initialize_normalized_url, on: [ :create ]
|
before_save :initialize_normalized_url, on: [ :create ]
|
||||||
before_save :normalize
|
before_save :normalize
|
||||||
validates :url, presence: true, uniqueness: true
|
validates :url, presence: true, uniqueness: { scope: :artist_id }
|
||||||
validate :validate_url_format
|
validate :validate_url_format
|
||||||
belongs_to :artist, :touch => true
|
belongs_to :artist, :touch => true
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
def assert_artist_found(expected_artist, source_url = nil)
|
def assert_artist_found(expected_artist, source_url = nil)
|
||||||
if source_url
|
if source_url
|
||||||
get_auth finder_artists_path(format: "json", url: source_url), @user
|
get_auth finder_artists_path(format: "json", url: source_url), @user
|
||||||
puts response.body
|
|
||||||
if response.body =~ /Net::OpenTimeout/
|
if response.body =~ /Net::OpenTimeout/
|
||||||
skip "Remote connection to #{source_url} failed"
|
skip "Remote connection to #{source_url} failed"
|
||||||
return
|
return
|
||||||
@@ -134,7 +133,7 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
context "with an artist that has notes" do
|
context "with an artist that has notes" do
|
||||||
setup do
|
setup do
|
||||||
as(@admin) do
|
as(@admin) do
|
||||||
@artist = create(:artist, name: "aaa", notes: "testing")
|
@artist = create(:artist, name: "aaa", notes: "testing", url_string: "htttp://example.com")
|
||||||
end
|
end
|
||||||
@wiki_page = @artist.wiki_page
|
@wiki_page = @artist.wiki_page
|
||||||
@another_user = create(:user)
|
@another_user = create(:user)
|
||||||
@@ -143,7 +142,7 @@ class ArtistsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
should "update an artist" do
|
should "update an artist" do
|
||||||
old_timestamp = @wiki_page.updated_at
|
old_timestamp = @wiki_page.updated_at
|
||||||
travel_to(1.minute.from_now) do
|
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
|
end
|
||||||
@artist.reload
|
@artist.reload
|
||||||
@wiki_page = @artist.wiki_page
|
@wiki_page = @artist.wiki_page
|
||||||
|
|||||||
Reference in New Issue
Block a user