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