]> git.openstreetmap.org Git - rails.git/blobdiff - test/functional/notes_controller_test.rb
Reject note comments with no text
[rails.git] / test / functional / notes_controller_test.rb
index 1c0ded3558f567a8417a53bbe20fbe8f85a0a6a0..3d12d151f8c78c5a31260ae8d9daa6904adb7ad6 100644 (file)
@@ -227,6 +227,11 @@ class NotesControllerTest < ActionController::TestCase
     end
     assert_response :bad_request
 
+    assert_no_difference('NoteComment.count') do
+      post :comment, {:id => notes(:open_note_with_comment).id, :text => ""}
+    end
+    assert_response :bad_request
+
     assert_no_difference('NoteComment.count') do
       post :comment, {:id => 12345, :text => "This is an additional comment"}
     end
@@ -236,6 +241,11 @@ class NotesControllerTest < ActionController::TestCase
       post :comment, {:id => notes(:hidden_note_with_comment).id, :text => "This is an additional comment"}
     end
     assert_response :gone
+
+    assert_no_difference('NoteComment.count') do
+      post :comment, {:id => notes(:closed_note_with_comment).id, :text => "This is an additional comment"}
+    end
+    assert_response :conflict
   end
 
   def test_note_close_success
@@ -273,6 +283,9 @@ class NotesControllerTest < ActionController::TestCase
 
     post :close, {:id => notes(:hidden_note_with_comment).id}
     assert_response :gone
+
+    post :close, {:id => notes(:closed_note_with_comment).id}
+    assert_response :conflict
   end
 
   def test_note_read_success