diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-04-16 08:05:17 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-04-16 08:05:17 +0000 |
commit | 224916f843d3cc7beff383217d199a8cabfec263 (patch) | |
tree | 53c31b691a75cf6f82c8b076d47b0df6f5d80195 | |
parent | a2ceace1bdf0b55afb3706c46ee13c962d417303 (diff) | |
parent | 2c98d6eef193c3562dc3b36529d434cc9eb6e8f2 (diff) | |
download | gitlab-ce-224916f843d3cc7beff383217d199a8cabfec263.tar.gz |
Merge branch 'bw-query_graphql_field-enhancement' into 'master'
Allow arrays to be specified for fields in graphql_query_for
Closes #60238
See merge request gitlab-org/gitlab-ce!27142
-rw-r--r-- | spec/requests/api/graphql/gitlab_schema_spec.rb | 2 | ||||
-rw-r--r-- | 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 { |