can no longer delete posts in locked forum topics

This commit is contained in:
albert
2011-10-22 13:47:46 -04:00
parent f07bf9b2cc
commit 9a3155d10b
2 changed files with 21 additions and 1 deletions

View File

@@ -14,6 +14,25 @@ class ForumPostTest < ActiveSupport::TestCase
CurrentUser.ip_addr = nil
end
context "belonging to a locked topic" do
setup do
@post = Factory.create(:forum_post, :topic_id => @topic.id, :body => "zzz")
@topic.update_attribute(:is_locked, true)
@post.reload
end
should "not be updateable" do
@post.update_attributes(:body => "xxx")
@post.reload
assert_equal("zzz", @post.body)
end
should "not be deletable" do
@post.destroy
assert_equal(1, ForumPost.count)
end
end
should "update its parent when saved" do
sleep 1
original_topic_updated_at = @topic.updated_at