diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/requests/api/graphql/group_query_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/requests/api/graphql/group_query_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/group_query_spec.rb | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/spec/requests/api/graphql/group_query_spec.rb b/spec/requests/api/graphql/group_query_spec.rb index b6bbf8d5dd2..fd0ee5d52b9 100644 --- a/spec/requests/api/graphql/group_query_spec.rb +++ b/spec/requests/api/graphql/group_query_spec.rb @@ -8,11 +8,11 @@ RSpec.describe 'getting group information' do include GraphqlHelpers include UploadHelpers - let(:user1) { create(:user, can_create_group: false) } - let(:user2) { create(:user) } - let(:admin) { create(:admin) } - let(:public_group) { create(:group, :public) } - let(:private_group) { create(:group, :private) } + let_it_be(:user1) { create(:user, can_create_group: false) } + let_it_be(:user2) { create(:user) } + let_it_be(:admin) { create(:admin) } + let_it_be(:private_group) { create(:group, :private) } + let_it_be(:public_group) { create(:group, :public) } # similar to the API "GET /groups/:id" describe "Query group(fullPath)" do @@ -78,6 +78,7 @@ RSpec.describe 'getting group information' do expect(graphql_data['group']['parentId']).to eq(group1.parent_id) expect(graphql_data['group']['issues']['nodes'].count).to eq(1) expect(graphql_data['group']['issues']['nodes'][0]['iid']).to eq(issue.iid.to_s) + expect(graphql_data['group']['sharedRunnersSetting']).to eq(group1.shared_runners_setting.upcase) end it "does not return a non existing group" do @@ -105,6 +106,20 @@ RSpec.describe 'getting group information' do expect { post_multiplex(queries, current_user: admin) } .to issue_same_number_of_queries_as { post_graphql(group_query(group1), current_user: admin) } end + + context "when querying group's descendant groups" do + let_it_be(:subgroup1) { create(:group, parent: public_group) } + let_it_be(:subgroup2) { create(:group, parent: subgroup1) } + + let(:descendants) { [subgroup1, subgroup2] } + + it 'returns all descendant groups user has access to' do + post_graphql(group_query(public_group), current_user: admin) + + names = graphql_data['group']['descendantGroups']['nodes'].map { |n| n['name'] } + expect(names).to match_array(descendants.map(&:name)) + end + end end context "when authenticated as admin" do |