diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-03-10 13:21:34 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-03-10 13:21:34 +0000 |
commit | 2de9e782ad2e18e3143d608a24f738a70e719c73 (patch) | |
tree | 37a6e008df5e2256211779180c811c4c432256ca /test/functional/messages_controller_test.rb | |
parent | d849d06b560ecdc7f4d9740788d317a406b9ab7b (diff) | |
download | redmine-2de9e782ad2e18e3143d608a24f738a70e719c73.tar.gz redmine-2de9e782ad2e18e3143d608a24f738a70e719c73.zip |
More function tests for MessagesController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9168 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/messages_controller_test.rb')
-rw-r--r-- | test/functional/messages_controller_test.rb | 32 |
1 files changed, 31 insertions, 1 deletions
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 |