Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab_schema_spec.rb « graphql « api « requests « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b63b4fb34df5f47f3ecc6baf3f9d48aa538a85bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'spec_helper'

describe 'GitlabSchema configurations' do
  include GraphqlHelpers

  it 'shows an error if complexity is too high' do
    project = create(:project, :repository)
    query   = graphql_query_for('project', { 'fullPath' => project.full_path }, %w(id name description))

    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