summaryrefslogtreecommitdiff
path: root/spec/requests/api/projects_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/projects_spec.rb')
-rw-r--r--spec/requests/api/projects_spec.rb38
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)