diff options
author | Brett Walker <bwalker@gitlab.com> | 2019-04-05 20:30:10 +0300 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2019-04-08 20:33:33 +0300 |
commit | e86a2e7eb27468de8357f27752a9f86ee926807e (patch) | |
tree | d95fce50b5495cb78926adbe3703a81b9478ad8d /spec/requests/api/graphql/gitlab_schema_spec.rb | |
parent | 425377f35747131bed6550170af576d3028b28f9 (diff) |
Increase GraphQL complexity
An IntrospectionQuery required more
complexity points.
Diffstat (limited to 'spec/requests/api/graphql/gitlab_schema_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/gitlab_schema_spec.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/spec/requests/api/graphql/gitlab_schema_spec.rb b/spec/requests/api/graphql/gitlab_schema_spec.rb index 708a000532b..f95f460fd14 100644 --- a/spec/requests/api/graphql/gitlab_schema_spec.rb +++ b/spec/requests/api/graphql/gitlab_schema_spec.rb @@ -3,14 +3,24 @@ require 'spec_helper' describe 'GitlabSchema configurations' do include GraphqlHelpers - let(:project) { create(:project, :repository) } - let!(:query) { graphql_query_for('project', 'fullPath' => project.full_path) } + 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") - it 'shows an error if complexity it too high' do allow(GitlabSchema).to receive(:max_query_complexity).and_return 1 post_graphql(query, current_user: nil) expect(graphql_errors.first['message']).to include('which exceeds max complexity of 1') end + + context 'when IntrospectionQuery' do + it 'is not too complex' do + query = File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql')) + + post_graphql(query, current_user: nil) + + expect(graphql_errors).to be_nil + end + end end |