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

metadata_query_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: 4c56c559cf922d402e3a515336950b21ff0c2c75 (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'

describe 'getting project information' do
  include GraphqlHelpers

  let(:query) { graphql_query_for('metadata', {}, all_graphql_fields_for('Metadata')) }

  context 'logged in' do
    it 'returns version and revision' do
      post_graphql(query, current_user: create(:user))

      expect(graphql_errors).to be_nil
      expect(graphql_data).to eq(
        'metadata' => {
          'version' => Gitlab::VERSION,
          'revision' => Gitlab.revision
        }
      )
    end
  end

  context 'anonymous user' do
    it 'returns nothing' do
      post_graphql(query, current_user: nil)

      expect(graphql_errors).to be_nil
      expect(graphql_data).to eq('metadata' => nil)
    end
  end
end