+ def test_note_comment_create_fail
+ assert_no_difference('NoteComment.count') do
+ post :update, {:name => "new_tester2", :text => "This is an additional comment"}
+ end
+ assert_response :bad_request
+
+ assert_no_difference('NoteComment.count') do
+ post :update, {:id => notes(:open_note_with_comment).id, :name => "new_tester2"}
+ end
+ assert_response :bad_request
+
+ assert_no_difference('NoteComment.count') do
+ post :update, {:id => 12345, :name => "new_tester2", :text => "This is an additional comment"}
+ end
+ assert_response :not_found
+
+ assert_no_difference('NoteComment.count') do
+ post :update, {:id => notes(:hidden_note_with_comment).id, :name => "new_tester2", :text => "This is an additional comment"}
+ end
+ assert_response :gone
+ end
+
+ def test_note_close_success
+ post :close, {:id => notes(:open_note_with_comment).id}
+ assert_response :success
+
+ get :read, {:id => notes(:open_note_with_comment).id, :format => 'json'}
+ assert_response :success
+ js = ActiveSupport::JSON.decode(@response.body)
+ assert_not_nil js
+ assert_equal notes(:open_note_with_comment).id, js["note"]["id"]
+ assert_equal "closed", js["note"]["status"]
+ assert_equal "closed", js["note"]["comments"].last["event"]
+ assert_equal "NoName (a)", js["note"]["comments"].last["author_name"]
+ end
+
+ def test_note_close_fail
+ post :close
+ assert_response :bad_request
+
+ post :close, {:id => 12345}
+ assert_response :not_found
+
+ post :close, {:id => notes(:hidden_note_with_comment).id}
+ assert_response :gone
+ end
+
+ def test_note_read_success
+ get :read, {:id => notes(:open_note).id}