mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:25:24 +08:00
New users can only post newuser_max_replies_per_topic
times per topic.
This commit is contained in:
@ -24,6 +24,20 @@ describe Validators::PostValidator do
|
||||
end
|
||||
end
|
||||
|
||||
context "too_many_posts" do
|
||||
it "should be invalid when the user has posted too much" do
|
||||
post.user.expects(:posted_too_much_in_topic?).returns(true)
|
||||
validator.max_posts_validator(post)
|
||||
expect(post.errors.count).to be > 0
|
||||
end
|
||||
|
||||
it "should be valid when the user hasn't posted too much" do
|
||||
post.user.expects(:posted_too_much_in_topic?).returns(false)
|
||||
validator.max_posts_validator(post)
|
||||
expect(post.errors.count).to be(0)
|
||||
end
|
||||
end
|
||||
|
||||
context "invalid post" do
|
||||
it "should be invalid" do
|
||||
validator.validate(post)
|
||||
|
Reference in New Issue
Block a user