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
2c98d6ee
Commit
2c98d6ee
authored
Apr 08, 2019
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow arrays to specify fields graphql_query_for
parent
7ae49f3c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
spec/requests/api/graphql/gitlab_schema_spec.rb
spec/requests/api/graphql/gitlab_schema_spec.rb
+1
-1
spec/support/helpers/graphql_helpers.rb
spec/support/helpers/graphql_helpers.rb
+2
-1
No files found.
spec/requests/api/graphql/gitlab_schema_spec.rb
View file @
2c98d6ee
...
@@ -5,7 +5,7 @@ describe 'GitlabSchema configurations' do
...
@@ -5,7 +5,7 @@ describe 'GitlabSchema configurations' do
it
'shows an error if complexity is too high'
do
it
'shows an error if complexity is too high'
do
project
=
create
(
:project
,
:repository
)
project
=
create
(
:project
,
:repository
)
query
=
graphql_query_for
(
'project'
,
{
'fullPath'
=>
project
.
full_path
},
"id
\n
name
\n
description"
)
query
=
graphql_query_for
(
'project'
,
{
'fullPath'
=>
project
.
full_path
},
%w(id name description)
)
allow
(
GitlabSchema
).
to
receive
(
:max_query_complexity
).
and_return
1
allow
(
GitlabSchema
).
to
receive
(
:max_query_complexity
).
and_return
1
...
...
spec/support/helpers/graphql_helpers.rb
View file @
2c98d6ee
...
@@ -83,7 +83,8 @@ module GraphqlHelpers
...
@@ -83,7 +83,8 @@ module GraphqlHelpers
end
end
def
wrap_fields
(
fields
)
def
wrap_fields
(
fields
)
return
unless
fields
.
strip
.
present?
fields
=
Array
.
wrap
(
fields
).
join
(
"
\n
"
)
return
unless
fields
.
present?
<<~
FIELDS
<<~
FIELDS
{
{
...
...
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