summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-06 12:54:13 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-06 12:54:13 +0000
commit8fb29d4d211ac09549cf47fad764b56c9173e938 (patch)
treec8d2602d42bda89397d75aa0344f2b47dcf7cc4b /test
parent2ad8242ae782ea9d87a0d98f8563199da736bdc7 (diff)
downloadredmine-8fb29d4d211ac09549cf47fad764b56c9173e938.tar.gz
redmine-8fb29d4d211ac09549cf47fad764b56c9173e938.zip
Adds pagination to forum messages (#4664).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3373 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/messages_controller_test.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb
index 2522f0a87..34614a9ef 100644
--- a/test/functional/messages_controller_test.rb
+++ b/test/functional/messages_controller_test.rb
@@ -47,6 +47,22 @@ class MessagesControllerTest < ActionController::TestCase
assert_not_nil assigns(:topic)
end
+ def test_show_with_pagination
+ message = Message.find(1)
+ assert_difference 'Message.count', 30 do
+ 30.times do
+ message.children << Message.new(:subject => 'Reply', :content => 'Reply body', :author_id => 2, :board_id => 1)
+ end
+ end
+ get :show, :board_id => 1, :id => 1, :r => message.children.last(:order => 'id').id
+ assert_response :success
+ assert_template 'show'
+ replies = assigns(:replies)
+ assert_not_nil replies
+ assert !replies.include?(message.children.first(:order => 'id'))
+ assert replies.include?(message.children.last(:order => 'id'))
+ end
+
def test_show_with_reply_permission
@request.session[:user_id] = 2
get :show, :board_id => 1, :id => 1
@@ -143,7 +159,8 @@ class MessagesControllerTest < ActionController::TestCase
def test_reply
@request.session[:user_id] = 2
post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' }
- assert_redirected_to 'boards/1/topics/1'
+ reply = Message.find(:first, :order => 'id DESC')
+ assert_redirected_to "boards/1/topics/1?r=#{reply.id}"
assert Message.find_by_subject('Test reply')
end