FIX: bypass TL0-specific validations on posts in a PM

This commit is contained in:
Régis Hanol
2016-04-18 22:08:42 +02:00
parent 163a3e195f
commit de9136a8f2
3 changed files with 27 additions and 12 deletions

View File

@ -67,6 +67,14 @@ describe Validators::PostValidator do
expect(post.errors.count).to be(0)
end
it "should be valid when new user exceeds max mentions limit in PM" do
post.acting_user = build(:newuser)
post.topic.expects(:private_message?).returns(true)
post.expects(:raw_mentions).returns(['jake', 'finn', 'jake_old'])
validator.max_mention_validator(post)
expect(post.errors.count).to be(0)
end
it "should be valid when elder user does not exceed max mentions limit" do
post.acting_user = build(:trust_level_4)
post.expects(:raw_mentions).returns(['jake', 'finn', 'jake_old'])