diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-07-07 15:09:57 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-07-07 15:09:57 +0000 |
commit | efc6abea07a7a437b0a68cfb297b53fbe6d9de2b (patch) | |
tree | db01dd284538ccbdfa67d719875d7e9467275bdd /test/unit/message_test.rb | |
parent | 851fbaf750d4bb1a579a02d636339793896050a6 (diff) | |
download | redmine-efc6abea07a7a437b0a68cfb297b53fbe6d9de2b.tar.gz redmine-efc6abea07a7a437b0a68cfb297b53fbe6d9de2b.zip |
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
Diffstat (limited to 'test/unit/message_test.rb')
-rw-r--r-- | test/unit/message_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/message_test.rb b/test/unit/message_test.rb index 8be6de31a..00b7351ee 100644 --- a/test/unit/message_test.rb +++ b/test/unit/message_test.rb @@ -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 |