posts: limit sources to 1200 chars long.

The longest sources on Danbooru are DeviantArt wixmp.com sources, which
max out at ~900 chars.
This commit is contained in:
evazion
2020-12-21 18:57:04 -06:00
parent 6ac9882711
commit 6c99bbbf47
2 changed files with 8 additions and 0 deletions

View File

@@ -1076,6 +1076,13 @@ class PostTest < ActiveSupport::TestCase
@post.update(:tag_string => "source:https://img18.pixiv.net/img/evazion/14901720.png")
assert_equal(14901720, @post.pixiv_id)
end
should "validate the max source length" do
@post.update(source: "X"*1201)
assert_equal(false, @post.valid?)
assert_equal(["is too long (maximum is 1200 characters)"], @post.errors[:source])
end
end
context "of" do