<%= wikitoolbar_for 'message_content' %>
diff --git a/test/fixtures/boards.yml b/test/fixtures/boards.yml
index b6b42aaa3..a4795c21e 100644
--- a/test/fixtures/boards.yml
+++ b/test/fixtures/boards.yml
@@ -6,8 +6,8 @@ boards_001:
id: 1
description: Help board
position: 1
- last_message_id: 5
- messages_count: 5
+ last_message_id: 6
+ messages_count: 6
boards_002:
name: Discussion
project_id: 1
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