More function tests for MessagesController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9168 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d849d06b56
commit
2de9e782ad
|
@ -141,15 +141,45 @@ class MessagesControllerTest < ActionController::TestCase
|
|||
|
||||
def test_destroy_topic
|
||||
@request.session[:user_id] = 2
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue