summaryrefslogtreecommitdiffstats
path: root/test/unit/message_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-04-05 10:08:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-04-05 10:08:11 +0000
commitca166b30e1b223c7f3aba3befc894a8597362592 (patch)
tree42d3a97b4d38db99ba3ff6a91aa23e75db44b5c4 /test/unit/message_test.rb
parent3d65ed7aa0b6892ca76160a89694acc4efa79f27 (diff)
downloadredmine-ca166b30e1b223c7f3aba3befc894a8597362592.tar.gz
redmine-ca166b30e1b223c7f3aba3befc894a8597362592.zip
Adds the ability to move threads between project forums (#2452). 'Edit message' permission is required.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2649 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/message_test.rb')
-rw-r--r--test/unit/message_test.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/unit/message_test.rb b/test/unit/message_test.rb
index b907cfef3..bc9bd5fd3 100644
--- a/test/unit/message_test.rb
+++ b/test/unit/message_test.rb
@@ -1,3 +1,20 @@
+# Redmine - project management software
+# Copyright (C) 2006-2009 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
require File.dirname(__FILE__) + '/../test_helper'
class MessageTest < Test::Unit::TestCase
@@ -47,6 +64,23 @@ class MessageTest < Test::Unit::TestCase
assert @message.watched_by?(reply_author)
end
+ def test_moving_message_should_update_counters
+ @message = Message.find(1)
+ assert_no_difference 'Message.count' do
+ # Previous board
+ assert_difference 'Board.find(1).topics_count', -1 do
+ assert_difference 'Board.find(1).messages_count', -(1 + @message.replies_count) do
+ # New board
+ assert_difference 'Board.find(2).topics_count' do
+ assert_difference 'Board.find(2).messages_count', (1 + @message.replies_count) do
+ @message.update_attributes(:board_id => 2)
+ end
+ end
+ end
+ end
+ end
+ end
+
def test_destroy_topic
message = Message.find(1)
board = message.board