Fixed: error raised when trying to add an empty comment to a news (#3615).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2820 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1a9942ba99
commit
d41bd93acb
|
@ -64,6 +64,7 @@ class NewsController < ApplicationController
|
||||||
flash[:notice] = l(:label_comment_added)
|
flash[:notice] = l(:label_comment_added)
|
||||||
redirect_to :action => 'show', :id => @news
|
redirect_to :action => 'show', :id => @news
|
||||||
else
|
else
|
||||||
|
show
|
||||||
render :action => 'show'
|
render :action => 'show'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -179,6 +179,15 @@ class NewsControllerTest < Test::Unit::TestCase
|
||||||
assert_equal User.find(2), comment.author
|
assert_equal User.find(2), comment.author
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_empty_comment_should_not_be_added
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
assert_no_difference 'Comment.count' do
|
||||||
|
post :add_comment, :id => 1, :comment => { :comments => '' }
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_destroy_comment
|
def test_destroy_comment
|
||||||
comments_count = News.find(1).comments.size
|
comments_count = News.find(1).comments.size
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
|
|
Loading…
Reference in New Issue