New users can only post newuser_max_replies_per_topic times per topic.

This commit is contained in:
Robin Ward
2013-12-19 13:45:55 -05:00
parent 39e711783d
commit 1cac9fa257
8 changed files with 68 additions and 1 deletions

View File

@ -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)