summaryrefslogtreecommitdiff
path: root/spec/features/graphiql_spec.rb
blob: 7729cdaa3621713a95c0875fd3cb1768a801e303 (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
27
28
29
30
31
32
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'GraphiQL' do
  context 'without relative_url_root' do
    before do
      visit '/-/graphql-explorer'
    end

    it 'has the correct graphQLEndpoint' do
      expect(page.body).to include('<div id="graphiql-container" data-graphql-endpoint-path="/api/graphql"')
    end
  end

  context 'with relative_url_root' do
    before do
      stub_config_setting(relative_url_root: '/gitlab/root')
      Rails.application.reload_routes!

      visit '/-/graphql-explorer'
    end

    after do
      Rails.application.reload_routes!
    end

    it 'has the correct graphQLEndpoint' do
      expect(page.body).to include('<div id="graphiql-container" data-graphql-endpoint-path="/gitlab/root/api/graphql"')
    end
  end
end