r18633@gaspard (orig r1875): jplang | 2008-09-17 21:18:31 +0200
reposman: change #log arguments. r18634@gaspard (orig r1876): jplang | 2008-09-17 21:38:20 +0200 Slight change on git repository creation command. r18635@gaspard (orig r1877): jplang | 2008-09-17 21:47:36 +0200 Make --command option usable on Windows. r18636@gaspard (orig r1878): jplang | 2008-09-19 17:32:52 +0200 Adds watch/unwatch functionality at forum topic level (#1912). Users who create/reply a topic are automatically added as watchers but are now able to unwatch the topic. r18637@gaspard (orig r1879): winterheart | 2008-09-19 18:15:49 +0200 update of ru.yml r18638@gaspard (orig r1880): winterheart | 2008-09-19 18:17:35 +0200 #1918, translation for zh-tw r18639@gaspard (orig r1881): winterheart | 2008-09-19 18:20:45 +0200 fixed #1920, patch for Hungarian language r18640@gaspard (orig r1882): winterheart | 2008-09-19 18:23:04 +0200 patch #1922, update for nl.yml r18641@gaspard (orig r1883): winterheart | 2008-09-19 18:26:19 +0200 #1923, updated zh.yml r18642@gaspard (orig r1884): winterheart | 2008-09-19 18:30:39 +0200 #1924, update for da.yml r18643@gaspard (orig r1885): winterheart | 2008-09-19 18:33:08 +0200 #1925, patch for lt.yml git-svn-id: http://redmine.rubyforge.org/svn/branches/nbc@1886 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
|
||||
class MessageTest < Test::Unit::TestCase
|
||||
fixtures :projects, :boards, :messages
|
||||
fixtures :projects, :boards, :messages, :users, :watchers
|
||||
|
||||
def setup
|
||||
@board = Board.find(1)
|
||||
@@ -20,6 +20,8 @@ class MessageTest < Test::Unit::TestCase
|
||||
# messages count incremented
|
||||
assert_equal messages_count+1, @board[:messages_count]
|
||||
assert_equal message, @board.last_message
|
||||
# author should be watching the message
|
||||
assert message.watched_by?(@user)
|
||||
end
|
||||
|
||||
def test_reply
|
||||
@@ -28,7 +30,8 @@ class MessageTest < Test::Unit::TestCase
|
||||
@message = Message.find(1)
|
||||
replies_count = @message.replies_count
|
||||
|
||||
reply = Message.new(:board => @board, :subject => 'Test reply', :content => 'Test reply content', :parent => @message, :author => @user)
|
||||
reply_author = User.find(2)
|
||||
reply = Message.new(:board => @board, :subject => 'Test reply', :content => 'Test reply content', :parent => @message, :author => reply_author)
|
||||
assert reply.save
|
||||
@board.reload
|
||||
# same topics count
|
||||
@@ -40,13 +43,18 @@ class MessageTest < Test::Unit::TestCase
|
||||
# replies count incremented
|
||||
assert_equal replies_count+1, @message[:replies_count]
|
||||
assert_equal reply, @message.last_reply
|
||||
# author should be watching the message
|
||||
assert @message.watched_by?(reply_author)
|
||||
end
|
||||
|
||||
def test_destroy_topic
|
||||
message = Message.find(1)
|
||||
board = message.board
|
||||
topics_count, messages_count = board.topics_count, board.messages_count
|
||||
assert message.destroy
|
||||
|
||||
assert_difference('Watcher.count', -1) do
|
||||
assert message.destroy
|
||||
end
|
||||
board.reload
|
||||
|
||||
# Replies deleted
|
||||
@@ -54,6 +62,7 @@ class MessageTest < Test::Unit::TestCase
|
||||
# Checks counters
|
||||
assert_equal topics_count - 1, board.topics_count
|
||||
assert_equal messages_count - 3, board.messages_count
|
||||
# Watchers removed
|
||||
end
|
||||
|
||||
def test_destroy_reply
|
||||
|
||||
Reference in New Issue
Block a user