Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c820a44b
Commit
c820a44b
authored
Nov 18, 2019
by
raju249
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for status 422 using empty note string
parent
86a973c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
app/controllers/concerns/notes_actions.rb
app/controllers/concerns/notes_actions.rb
+1
-1
spec/controllers/projects/notes_controller_spec.rb
spec/controllers/projects/notes_controller_spec.rb
+11
-0
No files found.
app/controllers/concerns/notes_actions.rb
View file @
c820a44b
...
...
@@ -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
...
...
spec/controllers/projects/notes_controller_spec.rb
View file @
c820a44b
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment