Refactor: move #destroy_comment method to CommentsController#destroy

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4172 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2010-09-23 15:20:19 +00:00
parent 4948121af0
commit 401197a895
8 changed files with 23 additions and 17 deletions
@@ -43,4 +43,15 @@ class CommentsControllerTest < ActionController::TestCase
assert_redirected_to 'news/1'
end
end
def test_destroy_comment
comments_count = News.find(1).comments.size
@request.session[:user_id] = 2
delete :destroy, :id => 1, :comment_id => 2
assert_redirected_to 'news/1'
assert_nil Comment.find_by_id(2)
assert_equal comments_count - 1, News.find(1).comments.size
end
end
-9
View File
@@ -111,15 +111,6 @@ class NewsControllerTest < ActionController::TestCase
:content => /1 error/
end
def test_destroy_comment
comments_count = News.find(1).comments.size
@request.session[:user_id] = 2
post :destroy_comment, :id => 1, :comment_id => 2
assert_redirected_to 'news/1'
assert_nil Comment.find_by_id(2)
assert_equal comments_count - 1, News.find(1).comments.size
end
def test_destroy
@request.session[:user_id] = 2
post :destroy, :id => 1
+2
View File
@@ -163,6 +163,8 @@ class RoutingTest < ActionController::IntegrationTest
should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
should_route :put, "/news/567/edit", :controller => 'news', :action => 'update', :id => '567'
should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
end
context "projects" do