From 2c98d6eef193c3562dc3b36529d434cc9eb6e8f2 Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Mon, 8 Apr 2019 14:02:22 -0500 Subject: Allow arrays to specify fields graphql_query_for --- spec/requests/api/graphql/gitlab_schema_spec.rb | 2 +- spec/support/helpers/graphql_helpers.rb | 3 ++- 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 { -- cgit v1.2.1