summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorJan Christophersen <jan@ruken.pw>2018-01-19 07:33:58 +0000
committerJames Lopez <james@gitlab.com>2018-01-19 07:33:58 +0000
commit795e546b1c3c2433c046ffa517c0569a6c9ccdd0 (patch)
treeae92be261cf27498776783570816265d0377470a /spec/requests
parent43538018261a5d1cccefecae895fad9e74adb1db (diff)
downloadgitlab-ce-795e546b1c3c2433c046ffa517c0569a6c9ccdd0.tar.gz
Resolve "Projects API: filter 'with_issues_enabled=true' returns projects with 'issues_enabled=false'"
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/projects_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index de1763015fa..97e7ffcd38e 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -150,6 +150,19 @@ describe API::Projects do
expect(json_response.find { |hash| hash['id'] == project.id }.keys).not_to include('open_issues_count')
end
+ context 'and with_issues_enabled=true' do
+ it 'only returns projects with issues enabled' do
+ project.project_feature.update_attribute(:issues_access_level, ProjectFeature::DISABLED)
+
+ get api('/projects?with_issues_enabled=true', user)
+
+ expect(response.status).to eq 200
+ expect(response).to include_pagination_headers
+ expect(json_response).to be_an Array
+ expect(json_response.map { |p| p['id'] }).not_to include(project.id)
+ end
+ end
+
it "does not include statistics by default" do
get api('/projects', user)
@@ -352,6 +365,19 @@ describe API::Projects do
let(:current_user) { user2 }
let(:projects) { [public_project] }
end
+
+ context 'and with_issues_enabled=true' do
+ it 'does not return private issue projects' do
+ project.project_feature.update_attribute(:issues_access_level, ProjectFeature::PRIVATE)
+
+ get api('/projects?with_issues_enabled=true', user2)
+
+ expect(response.status).to eq 200
+ expect(response).to include_pagination_headers
+ expect(json_response).to be_an Array
+ expect(json_response.map { |p| p['id'] }).not_to include(project.id)
+ end
+ end
end
context 'when authenticated as admin' do