summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2019-04-08 14:02:22 -0500
committerBrett Walker <bwalker@gitlab.com>2019-04-11 11:32:13 -0500
commit2c98d6eef193c3562dc3b36529d434cc9eb6e8f2 (patch)
tree285c76105a6ad82f5d2252a204cd55ab98725a8b
parent7ae49f3c6c2560cec05f63af94c0f1e0f2df818a (diff)
downloadgitlab-ce-bw-query_graphql_field-enhancement.tar.gz
Allow arrays to specify fields graphql_query_forbw-query_graphql_field-enhancement
-rw-r--r--spec/requests/api/graphql/gitlab_schema_spec.rb2
-rw-r--r--spec/support/helpers/graphql_helpers.rb3
2 files changed, 3 insertions, 2 deletions
diff --git a/spec/requests/api/graphql/gitlab_schema_spec.rb b/spec/requests/api/graphql/gitlab_schema_spec.rb
index f95f460fd14..b63b4fb34df 100644
--- a/spec/requests/api/graphql/gitlab_schema_spec.rb
+++ b/spec/requests/api/graphql/gitlab_schema_spec.rb
@@ -5,7 +5,7 @@ describe 'GitlabSchema configurations' do
it 'shows an error if complexity is too high' do
project = create(:project, :repository)
- query = graphql_query_for('project', { 'fullPath' => project.full_path }, "id\nname\ndescription")
+ query = graphql_query_for('project', { 'fullPath' => project.full_path }, %w(id name description))
allow(GitlabSchema).to receive(:max_query_complexity).and_return 1
diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb
index f59f42ee902..2f4e6e4c934 100644
--- a/spec/support/helpers/graphql_helpers.rb
+++ b/spec/support/helpers/graphql_helpers.rb
@@ -83,7 +83,8 @@ module GraphqlHelpers
end
def wrap_fields(fields)
- return unless fields.strip.present?
+ fields = Array.wrap(fields).join("\n")
+ return unless fields.present?
<<~FIELDS
{