diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-19 03:09:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-19 03:09:15 +0300 |
commit | 60f63d15794e62c4bac9756445f618cd9acb8654 (patch) | |
tree | 30c2b2dc678995dd332b32672f9faa460fabdb79 /spec/support/shared_contexts | |
parent | 93d7441cc98c1db55797a2181a3d9f4b3d26d82c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_contexts')
-rw-r--r-- | spec/support/shared_contexts/requests/api/graphql/group_and_project_boards_query_shared_context.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/support/shared_contexts/requests/api/graphql/group_and_project_boards_query_shared_context.rb b/spec/support/shared_contexts/requests/api/graphql/group_and_project_boards_query_shared_context.rb new file mode 100644 index 00000000000..e744c3d0abb --- /dev/null +++ b/spec/support/shared_contexts/requests/api/graphql/group_and_project_boards_query_shared_context.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +RSpec.shared_context 'group and project boards query context' do + let_it_be(:user) { create :user } + let(:current_user) { user } + let(:params) { '' } + let(:board_parent_type) { board_parent.class.to_s.downcase } + let(:start_cursor) { graphql_data[board_parent_type]['boards']['pageInfo']['startCursor'] } + let(:end_cursor) { graphql_data[board_parent_type]['boards']['pageInfo']['endCursor'] } + + def query(board_params = params) + graphql_query_for( + board_parent_type, + { 'fullPath' => board_parent.full_path }, + <<~BOARDS + boards(#{board_params}) { + pageInfo { + startCursor + endCursor + } + edges { + node { + #{all_graphql_fields_for('boards'.classify)} + } + } + } + BOARDS + ) + end + + def grab_names(data = boards_data) + data.map do |board| + board.dig('node', 'name') + end + end +end |