Fixed that deleting the last reply of a topic does not update last_reply_id.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9939 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-07-07 15:09:57 +00:00
parent 851fbaf750
commit efc6abea07
2 changed files with 21 additions and 10 deletions
+15
View File
@@ -133,6 +133,21 @@ class MessageTest < ActiveSupport::TestCase
assert_equal messages_count - 1, board.messages_count
end
def test_destroying_last_reply_should_update_topic_last_reply_id
topic = Message.find(4)
assert_equal 6, topic.last_reply_id
assert_difference 'Message.count', -1 do
Message.find(6).destroy
end
assert_equal 5, topic.reload.last_reply_id
assert_difference 'Message.count', -1 do
Message.find(5).destroy
end
assert_nil topic.reload.last_reply_id
end
def test_editable_by
message = Message.find(6)
author = message.author