diff options
author | J.D. Bean <jonathandbean@gmail.com> | 2018-10-26 18:12:14 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-10-26 18:12:14 +0300 |
commit | ff89680330584d9f589486605eae721a7566aef7 (patch) | |
tree | a07f857b91cf95a214c6597a01316ee5ca0e971e /spec | |
parent | 83e898a57cd1b396968a0befe277b6d9d1507a11 (diff) |
Feature/add license to project API
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 22e5a7c7174..62b6a3ce42e 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -200,6 +200,24 @@ describe API::Projects do expect(json_response.first).to include 'statistics' end + it "does not include license by default" do + get api('/projects', user) + + expect(response).to have_gitlab_http_status(200) + expect(response).to include_pagination_headers + expect(json_response).to be_an Array + expect(json_response.first).not_to include('license', 'license_url') + end + + it "does not include license if requested" do + get api('/projects', user), license: true + + expect(response).to have_gitlab_http_status(200) + expect(response).to include_pagination_headers + expect(json_response).to be_an Array + expect(json_response.first).not_to include('license', 'license_url') + end + context 'when external issue tracker is enabled' do let!(:jira_service) { create(:jira_service, project: project) } @@ -994,6 +1012,26 @@ describe API::Projects do }) end + it "does not include license fields by default" do + get api("/projects/#{project.id}", user) + + expect(response).to have_gitlab_http_status(200) + expect(json_response).not_to include('license', 'license_url') + end + + it 'includes license fields when requested' do + get api("/projects/#{project.id}", user), license: true + + expect(response).to have_gitlab_http_status(200) + expect(json_response['license']).to eq({ + 'key' => project.repository.license.key, + 'name' => project.repository.license.name, + 'nickname' => project.repository.license.nickname, + 'html_url' => project.repository.license.url, + 'source_url' => project.repository.license.meta['source'] + }) + end + it "does not include statistics by default" do get api("/projects/#{project.id}", user) |