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

release_links_type_spec.rb « types « graphql « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e77c4e3ddd172f6834add47ed6bbd72c99ddcded (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe GitlabSchema.types['ReleaseLinks'] do
  it { expect(described_class).to require_graphql_authorizations(:read_release) }

  it 'has the expected fields' do
    expected_fields = %w[
      selfUrl
      openedMergeRequestsUrl
      mergedMergeRequestsUrl
      closedMergeRequestsUrl
      openedIssuesUrl
      closedIssuesUrl
      editUrl
    ]

    expect(described_class).to include_graphql_fields(*expected_fields)
  end

  context 'individual field authorization' do
    def fetch_authorizations(field_name)
      described_class.fields.dig(field_name).instance_variable_get(:@authorize)
    end

    describe 'openedMergeRequestsUrl' do
      it 'has valid authorization' do
        expect(fetch_authorizations('openedMergeRequestsUrl')).to include(:download_code)
      end
    end

    describe 'mergedMergeRequestsUrl' do
      it 'has valid authorization' do
        expect(fetch_authorizations('mergedMergeRequestsUrl')).to include(:download_code)
      end
    end

    describe 'closedMergeRequestsUrl' do
      it 'has valid authorization' do
        expect(fetch_authorizations('closedMergeRequestsUrl')).to include(:download_code)
      end
    end

    describe 'openedIssuesUrl' do
      it 'has valid authorization' do
        expect(fetch_authorizations('openedIssuesUrl')).to include(:download_code)
      end
    end

    describe 'closedIssuesUrl' do
      it 'has valid authorization' do
        expect(fetch_authorizations('closedIssuesUrl')).to include(:download_code)
      end
    end

    describe 'editUrl' do
      it 'has valid authorization' do
        expect(fetch_authorizations('editUrl')).to include(:update_release)
      end
    end
  end
end