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
ef1785c1
Commit
ef1785c1
authored
Nov 24, 2020
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace complex map union with MergeHash
parent
37a0205d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
spec/support/helpers/graphql_helpers.rb
spec/support/helpers/graphql_helpers.rb
+3
-5
No files found.
spec/support/helpers/graphql_helpers.rb
View file @
ef1785c1
...
...
@@ -4,6 +4,7 @@ module GraphqlHelpers
MutationDefinition
=
Struct
.
new
(
:query
,
:variables
)
NoData
=
Class
.
new
(
StandardError
)
UnauthorizedObject
=
Class
.
new
(
StandardError
)
# makes an underscored string look like a fieldname
# "merge_request" => "mergeRequest"
...
...
@@ -127,15 +128,12 @@ module GraphqlHelpers
end
def
serialize_variables
(
variables
)
return
unless
variables
return
variables
if
variables
.
is_a?
(
String
)
variables
=
variables
.
is_a?
(
Array
)
?
variables
.
map
(
&
:to_h
).
reduce
{
|
a
,
b
|
a
.
merge
(
b
)
}
:
variables
.
try
(
:to_h
)
variables
.
to_json
::
Gitlab
::
Utils
::
MergeHash
.
merge
(
Array
.
wrap
(
variables
).
map
(
&
:to_h
)).
to_json
end
UnauthorizedObject
=
Class
.
new
(
StandardError
)
def
resolve_field
(
name
,
object
,
args
=
{},
current_user:
nil
)
q
=
GraphQL
::
Query
.
new
(
GitlabSchema
)
context
=
GraphQL
::
Query
::
Context
.
new
(
query:
q
,
object:
object
,
values:
{
current_user:
current_user
})
...
...
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