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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/graphql/ci/project_variables_spec.rb')
-rw-r--r--spec/requests/api/graphql/ci/project_variables_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/requests/api/graphql/ci/project_variables_spec.rb b/spec/requests/api/graphql/ci/project_variables_spec.rb
index 0338b58a0ea..f9a32b42b4d 100644
--- a/spec/requests/api/graphql/ci/project_variables_spec.rb
+++ b/spec/requests/api/graphql/ci/project_variables_spec.rb
@@ -66,4 +66,32 @@ RSpec.describe 'Query.project(fullPath).ciVariables', feature_category: :pipelin
expect(graphql_data.dig('project', 'ciVariables')).to be_nil
end
end
+
+ describe 'sorting and pagination' do
+ let_it_be(:current_user) { user }
+ let_it_be(:data_path) { [:project, :ci_variables] }
+ let_it_be(:variables) do
+ [
+ create(:ci_variable, project: project, key: 'd'),
+ create(:ci_variable, project: project, key: 'a'),
+ create(:ci_variable, project: project, key: 'c'),
+ create(:ci_variable, project: project, key: 'e'),
+ create(:ci_variable, project: project, key: 'b')
+ ]
+ end
+
+ def pagination_query(params)
+ graphql_query_for(
+ :project,
+ { fullPath: project.full_path },
+ query_graphql_field('ciVariables', params, "#{page_info} nodes { id }")
+ )
+ end
+
+ before do
+ project.add_maintainer(current_user)
+ end
+
+ it_behaves_like 'sorted paginated variables'
+ end
end