summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-01-19 18:51:38 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-01-19 18:51:38 +0000
commit20cc4bc47533f34b62b7c8283e8de4eee8c5b852 (patch)
tree19bf81eec96ad7e803d4927bf95686b19798e5f0 /spec
parent084614dec8e135eafc8d1868ee0d2f75ab722c33 (diff)
parentae6080c791ee8b6aedd7091e2a321f5fe41f0978 (diff)
downloadgitlab-ce-20cc4bc47533f34b62b7c8283e8de4eee8c5b852.tar.gz
Merge branch 'add-public-param-to-project-api' into 'master'
Add public params to GET /projects api. Closes #3788 See merge request !2409
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/projects_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 6f4c336b66c..2a310f3834d 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -90,6 +90,29 @@ describe API::API, api: true do
end
end
+ context 'and using the visibility filter' do
+ it 'should filter based on private visibility param' do
+ get api('/projects', user), { visibility: 'private' }
+ expect(response.status).to eq(200)
+ expect(json_response).to be_an Array
+ expect(json_response.length).to eq(user.namespace.projects.where(visibility_level: Gitlab::VisibilityLevel::PRIVATE).count)
+ end
+
+ it 'should filter based on internal visibility param' do
+ get api('/projects', user), { visibility: 'internal' }
+ expect(response.status).to eq(200)
+ expect(json_response).to be_an Array
+ expect(json_response.length).to eq(user.namespace.projects.where(visibility_level: Gitlab::VisibilityLevel::INTERNAL).count)
+ end
+
+ it 'should filter based on public visibility param' do
+ get api('/projects', user), { visibility: 'public' }
+ expect(response.status).to eq(200)
+ expect(json_response).to be_an Array
+ expect(json_response.length).to eq(user.namespace.projects.where(visibility_level: Gitlab::VisibilityLevel::PUBLIC).count)
+ end
+ end
+
context 'and using sorting' do
before do
project2