add unit message test of cannot reply to a locked topic

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7554 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-10-01 01:11:02 +00:00
parent d817b063ec
commit 8f362558b6
1 changed files with 18 additions and 0 deletions

View File

@ -68,6 +68,24 @@ class MessageTest < ActiveSupport::TestCase
assert @message.watched_by?(reply_author)
end
def test_cannot_reply_to_locked_topic
topics_count = @board.topics_count
messages_count = @board.messages_count
@message = Message.find(1)
replies_count = @message.replies_count
assert_equal false, @message.locked
@message.locked = true
assert @message.save
assert_equal true, @message.locked
reply_author = User.find(2)
reply = Message.new(:board => @board, :subject => 'Test reply',
:content => 'Test reply content',
:parent => @message, :author => reply_author)
reply.save
assert_equal 1, reply.errors.count
end
def test_moving_message_should_update_counters
@message = Message.find(1)
assert_no_difference 'Message.count' do