From 2de9e782ad2e18e3143d608a24f738a70e719c73 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 10 Mar 2012 13:21:34 +0000 Subject: [PATCH] More function tests for MessagesController. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9168 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/messages_controller_test.rb | 32 ++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb index 70df6f0b5..1b892cb7a 100644 --- a/test/functional/messages_controller_test.rb +++ b/test/functional/messages_controller_test.rb @@ -141,15 +141,45 @@ class MessagesControllerTest < ActionController::TestCase def test_destroy_topic @request.session[:user_id] = 2 - post :destroy, :board_id => 1, :id => 1 + assert_difference 'Message.count', -3 do + post :destroy, :board_id => 1, :id => 1 + end assert_redirected_to '/projects/ecookbook/boards/1' assert_nil Message.find_by_id(1) end + def test_destroy_reply + @request.session[:user_id] = 2 + assert_difference 'Message.count', -1 do + post :destroy, :board_id => 1, :id => 2 + end + assert_redirected_to '/boards/1/topics/1?r=2' + assert_nil Message.find_by_id(2) + end + def test_quote @request.session[:user_id] = 2 xhr :get, :quote, :board_id => 1, :id => 3 assert_response :success assert_select_rjs :show, 'reply' end + + def test_preview_new + @request.session[:user_id] = 2 + post :preview, + :board_id => 1, + :message => {:subject => "", :content => "Previewed text"} + assert_response :success + assert_template 'common/_preview' + end + + def test_preview_edit + @request.session[:user_id] = 2 + post :preview, + :id => 4, + :board_id => 1, + :message => {:subject => "", :content => "Previewed text"} + assert_response :success + assert_template 'common/_preview' + end end -- 2.39.5