@@ -64,6 +64,7 class NewsController < ApplicationController | |||
|
64 | 64 | flash[:notice] = l(:label_comment_added) |
|
65 | 65 | redirect_to :action => 'show', :id => @news |
|
66 | 66 | else |
|
67 | show | |
|
67 | 68 | render :action => 'show' |
|
68 | 69 | end |
|
69 | 70 | end |
@@ -179,6 +179,15 class NewsControllerTest < Test::Unit::TestCase | |||
|
179 | 179 | assert_equal User.find(2), comment.author |
|
180 | 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 | 191 | def test_destroy_comment |
|
183 | 192 | comments_count = News.find(1).comments.size |
|
184 | 193 | @request.session[:user_id] = 2 |
General Comments 0
You need to be logged in to leave comments.
Login now