]> source.dussan.org Git - redmine.git/commitdiff
add unit message test of cannot reply to a locked topic
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sat, 1 Oct 2011 01:11:02 +0000 (01:11 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sat, 1 Oct 2011 01:11:02 +0000 (01:11 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7554 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/message_test.rb

index 79b994b5c8ca75c5d9218c96dba2df8af11b259a..dbfb2e8e292f671c8331b8e27c7ed76535da08c4 100644 (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