diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/requests/api/graphql/project_query_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/requests/api/graphql/project_query_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/project_query_spec.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/requests/api/graphql/project_query_spec.rb b/spec/requests/api/graphql/project_query_spec.rb index b367bbaaf43..54375d4de1d 100644 --- a/spec/requests/api/graphql/project_query_spec.rb +++ b/spec/requests/api/graphql/project_query_spec.rb @@ -65,7 +65,7 @@ RSpec.describe 'getting project information' do end it 'includes topics array' do - project.update!(tag_list: 'topic1, topic2, topic3') + project.update!(topic_list: 'topic1, topic2, topic3') post_graphql(query, current_user: current_user) @@ -119,6 +119,29 @@ RSpec.describe 'getting project information' do end end + context 'when the user has reporter access to the project' do + let(:statistics_query) do + <<~GRAPHQL + { + project(fullPath: "#{project.full_path}") { + statistics { wikiSize } + } + } + GRAPHQL + end + + before do + project.add_reporter(current_user) + create(:project_statistics, project: project, wiki_size: 100) + end + + it 'allows fetching project statistics' do + post_graphql(statistics_query, current_user: current_user) + + expect(graphql_data.dig('project', 'statistics')).to include('wikiSize' => 100.0) + end + end + context 'when the user does not have access to the project' do it 'returns an empty field' do post_graphql(query, current_user: current_user) |