FIX: admins bypass some post validations. This allows them to edit legal docs even if those docs are longer than max post length, for example.

This commit is contained in:
Neil Lalonde
2014-07-28 16:40:06 -04:00
parent 81ff121fe8
commit e1be478ef4
4 changed files with 67 additions and 9 deletions

View File

@@ -86,4 +86,22 @@ describe Validators::PostValidator do
end
end
context "acting_user is an admin" do
before do
post.acting_user = Fabricate(:admin)
end
it "skips most validations" do
validator.expects(:stripped_length).never
validator.expects(:raw_quality).never
validator.expects(:max_posts_validator).never
validator.expects(:max_mention_validator).never
validator.expects(:max_images_validator).never
validator.expects(:max_attachments_validator).never
validator.expects(:max_links_validator).never
validator.expects(:unique_post_validator).never
validator.validate(post)
end
end
end