diff options
author | Jan Christophersen <jan@ruken.pw> | 2018-01-19 10:33:58 +0300 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2018-01-19 10:33:58 +0300 |
commit | 795e546b1c3c2433c046ffa517c0569a6c9ccdd0 (patch) | |
tree | ae92be261cf27498776783570816265d0377470a /spec | |
parent | 43538018261a5d1cccefecae895fad9e74adb1db (diff) |
Resolve "Projects API: filter 'with_issues_enabled=true' returns projects with 'issues_enabled=false'"
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 26 |
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 |