Commit c820a44b authored by raju249's avatar raju249

Add spec for status 422 using empty note string

parent 86a973c6
......@@ -64,7 +64,7 @@ module NotesActions
end
if @note.errors.present? && @note.errors.keys != [:commands_only]
render json: json, status: 422
render json: json, status: :unprocessable_entity
else
render json: json
end
......
......@@ -259,6 +259,17 @@ describe Projects::NotesController do
end
end
context 'the note does not have commands_only errors' do
context 'for empty note' do
let(:note_text) { '' }
let(:extra_request_params) { { format: :json } }
it "returns status 422 for json" do
expect(response).to have_gitlab_http_status(422)
end
end
end
context 'the project is a private project' do
let(:project_visibility) { Gitlab::VisibilityLevel::PRIVATE }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment