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
688c0414
Commit
688c0414
authored
Nov 26, 2020
by
charlie ablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GraphQL error for test/dev
Update some tests to match loosely instead of exactly
parent
07274bf4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
app/controllers/graphql_controller.rb
app/controllers/graphql_controller.rb
+5
-1
ee/spec/requests/api/graphql/mutations/dast_site_profiles/create_spec.rb
...s/api/graphql/mutations/dast_site_profiles/create_spec.rb
+3
-1
ee/spec/requests/api/graphql/mutations/dast_site_profiles/delete_spec.rb
...s/api/graphql/mutations/dast_site_profiles/delete_spec.rb
+3
-1
No files found.
app/controllers/graphql_controller.rb
View file @
688c0414
...
...
@@ -37,8 +37,12 @@ class GraphqlController < ApplicationController
rescue_from
StandardError
do
|
exception
|
log_exception
(
exception
)
if
Rails
.
env
.
test?
||
Rails
.
env
.
development?
render_error
(
"Internal server error:
#{
exception
.
message
}
"
)
else
render_error
(
"Internal server error"
)
end
end
rescue_from
Gitlab
::
Graphql
::
Variables
::
Invalid
do
|
exception
|
render_error
(
exception
.
message
,
status: :unprocessable_entity
)
...
...
ee/spec/requests/api/graphql/mutations/dast_site_profiles/create_spec.rb
View file @
688c0414
...
...
@@ -32,7 +32,9 @@ RSpec.describe 'Creating a DAST Site Profile' do
allow
(
DastSiteProfile
).
to
receive
(
:create!
).
and_raise
(
StandardError
)
end
it_behaves_like
'a mutation that returns top-level errors'
,
errors:
[
'Internal server error'
]
it_behaves_like
'a mutation that returns top-level errors'
do
let
(
:match_errors
)
{
contain_exactly
(
include
(
'Internal server error'
))
}
end
end
end
end
ee/spec/requests/api/graphql/mutations/dast_site_profiles/delete_spec.rb
View file @
688c0414
...
...
@@ -38,7 +38,9 @@ RSpec.describe 'Creating a DAST Site Profile' do
dast_site_profile
.
destroy!
end
it_behaves_like
'a mutation that returns top-level errors'
,
errors:
[
'Internal server error'
]
it_behaves_like
'a mutation that returns top-level errors'
do
let
(
:match_errors
)
{
contain_exactly
(
include
(
"Internal server error: Couldn't find DastSiteProfile"
))
}
end
end
context
'when wrong type of global id is passed'
do
...
...
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