##// END OF EJS Templates
Fixed: error raised when trying to add an empty comment to a news (#3615)....
Jean-Philippe Lang -
r2715:d41bd93acbea
parent child
Show More
@@ -64,6 +64,7 class NewsController < ApplicationController
64 flash[:notice] = l(:label_comment_added)
64 flash[:notice] = l(:label_comment_added)
65 redirect_to :action => 'show', :id => @news
65 redirect_to :action => 'show', :id => @news
66 else
66 else
67 show
67 render :action => 'show'
68 render :action => 'show'
68 end
69 end
69 end
70 end
@@ -179,6 +179,15 class NewsControllerTest < Test::Unit::TestCase
179 assert_equal User.find(2), comment.author
179 assert_equal User.find(2), comment.author
180 end
180 end
181
181
182 def test_empty_comment_should_not_be_added
183 @request.session[:user_id] = 2
184 assert_no_difference 'Comment.count' do
185 post :add_comment, :id => 1, :comment => { :comments => '' }
186 assert_response :success
187 assert_template 'show'
188 end
189 end
190
182 def test_destroy_comment
191 def test_destroy_comment
183 comments_count = News.find(1).comments.size
192 comments_count = News.find(1).comments.size
184 @request.session[:user_id] = 2
193 @request.session[:user_id] = 2
General Comments 0
You need to be logged in to leave comments. Login now