From 04b046587fe609cd889f3fa518f08299abc61267 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Tue, 26 Jun 2018 18:31:05 +0200 Subject: Add pipeline lists to GraphQL This adds Keyset pagination to GraphQL lists. PoC for that is pipelines on merge requests and projects. When paginating a list, the base-64 encoded id of the ordering field (in most cases the primary key) can be passed in the `before` or `after` GraphQL argument. --- .../projects/pipelines_controller_spec.rb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'spec/controllers') diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index 9618a8417ec..1cc7f33b57a 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -4,7 +4,7 @@ describe Projects::PipelinesController do include ApiHelpers set(:user) { create(:user) } - set(:project) { create(:project, :public, :repository) } + let(:project) { create(:project, :public, :repository) } let(:feature) { ProjectFeature::DISABLED } before do @@ -91,6 +91,24 @@ describe Projects::PipelinesController do end end + context 'when the project is private' do + let(:project) { create(:project, :private, :repository) } + + it 'returns `not_found` when the user does not have access' do + sign_in(create(:user)) + + get_pipelines_index_json + + expect(response).to have_gitlab_http_status(:not_found) + end + + it 'returns the pipelines when the user has access' do + get_pipelines_index_json + + expect(json_response['pipelines'].size).to eq(5) + end + end + def get_pipelines_index_json get :index, namespace_id: project.namespace, project_id: project, -- cgit v1.2.3