summaryrefslogtreecommitdiffstats
path: root/test/functional/comments_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/comments_controller_test.rb')
-rw-r--r--test/functional/comments_controller_test.rb26
1 files changed, 22 insertions, 4 deletions
diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb
index 9ba469eed..466617b8c 100644
--- a/test/functional/comments_controller_test.rb
+++ b/test/functional/comments_controller_test.rb
@@ -26,7 +26,12 @@ class CommentsControllerTest < Redmine::ControllerTest
def test_add_comment
@request.session[:user_id] = 2
- post :create, :id => 1, :comment => { :comments => 'This is a test comment' }
+ post :create, :params => {
+ :id => 1,
+ :comment => {
+ :comments => 'This is a test comment'
+ }
+ }
assert_redirected_to '/news/1'
comment = News.find(1).comments.last
@@ -38,7 +43,12 @@ class CommentsControllerTest < Redmine::ControllerTest
def test_empty_comment_should_not_be_added
@request.session[:user_id] = 2
assert_no_difference 'Comment.count' do
- post :create, :id => 1, :comment => { :comments => '' }
+ post :create, :params => {
+ :id => 1,
+ :comment => {
+ :comments => ''
+ }
+ }
assert_response :redirect
assert_redirected_to '/news/1'
end
@@ -48,7 +58,12 @@ class CommentsControllerTest < Redmine::ControllerTest
News.any_instance.stubs(:commentable?).returns(false)
@request.session[:user_id] = 2
assert_no_difference 'Comment.count' do
- post :create, :id => 1, :comment => { :comments => 'This is a test comment' }
+ post :create, :params => {
+ :id => 1,
+ :comment => {
+ :comments => 'This is a test comment'
+ }
+ }
assert_response 403
end
end
@@ -56,7 +71,10 @@ class CommentsControllerTest < Redmine::ControllerTest
def test_destroy_comment
comments_count = News.find(1).comments.size
@request.session[:user_id] = 2
- delete :destroy, :id => 1, :comment_id => 2
+ delete :destroy, :params => {
+ :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