summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-06-26 18:31:05 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-07-04 10:53:39 +0200
commit04b046587fe609cd889f3fa518f08299abc61267 (patch)
tree634fc7d5e2a416950868700a82c171ff4f54239b /spec/controllers
parentcd5789415b6e561564073693243e890e79596ed2 (diff)
downloadgitlab-ce-04b046587fe609cd889f3fa518f08299abc61267.tar.gz
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.
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/pipelines_controller_spec.rb20
1 files changed, 19 insertions, 1 deletions
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,