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
3d587989
Commit
3d587989
authored
Mar 01, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GraphqlHelpers#new_resolver method
parent
984b9273
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
spec/support/helpers/graphql_helpers.rb
spec/support/helpers/graphql_helpers.rb
+11
-0
No files found.
spec/support/helpers/graphql_helpers.rb
View file @
3d587989
...
...
@@ -259,6 +259,17 @@ module GraphqlHelpers
::
Gitlab
::
Utils
::
MergeHash
.
merge
(
Array
.
wrap
(
variables
).
map
(
&
:to_h
)).
to_json
end
def
new_resolver
(
resolved_value
=
'Resolved value'
,
method: :resolve
)
case
resolved_value
when
:resolve
simple_resolver
(
resolved_value
)
when
:find_object
find_object_resolver
(
resolved_value
)
else
raise
"Cannot build a resolver for
#{
method
}
"
end
end
def
simple_resolver
(
resolved_value
=
'Resolved value'
)
Class
.
new
(
Resolvers
::
BaseResolver
)
do
define_method
:resolve
do
|**
_args
|
...
...
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