add more intelligent js for artist forms

This commit is contained in:
Albert Yi
2016-10-18 14:53:44 -07:00
parent 2424f24fcd
commit 2a5343b8cf
7 changed files with 45 additions and 37 deletions

View File

@@ -101,6 +101,18 @@ class ArtistTest < ActiveSupport::TestCase
assert_equal(artist.name, artist.wiki_page.title)
end
context "when a wiki page with the same name already exists" do
setup do
@wiki_page = FactoryGirl.create(:wiki_page, :title => "aaa")
@artist = FactoryGirl.build(:artist, :name => "aaa")
end
should "not validate" do
@artist.save
assert_equal(["Name conflicts with a wiki page"], @artist.errors.full_messages)
end
end
should "update the wiki page when notes are assigned" do
artist = FactoryGirl.create(:artist, :name => "aaa", :notes => "testing")
artist.update_attribute(:notes, "kokoko")