summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/comments_controller_test.rb11
-rw-r--r--test/functional/news_controller_test.rb9
-rw-r--r--test/integration/routing_test.rb2
3 files changed, 13 insertions, 9 deletions
diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb
index 1a9d628d8..1887c4896 100644
--- a/test/functional/comments_controller_test.rb
+++ b/test/functional/comments_controller_test.rb
@@ -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
diff --git a/test/functional/news_controller_test.rb b/test/functional/news_controller_test.rb
index ddc8b0c2c..219c4d7a7 100644
--- a/test/functional/news_controller_test.rb
+++ b/test/functional/news_controller_test.rb
@@ -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
diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb
index 4ce8fe4a7..3376f9313 100644
--- a/test/integration/routing_test.rb
+++ b/test/integration/routing_test.rb
@@ -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