From b0b4ae1875529cd7ca786bd5eccd49be9a40a038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarka=20Kadlecov=C3=A1?= Date: Tue, 13 Feb 2018 13:41:35 +0100 Subject: API - Include project in commits&blobs search results --- spec/fixtures/api/schemas/public_api/v4/blobs.json | 3 ++- spec/fixtures/api/schemas/public_api/v4/commit/detail.json | 7 ++++--- spec/fixtures/api/schemas/public_api/v4/commits_details.json | 4 ++++ spec/requests/api/search_spec.rb | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 spec/fixtures/api/schemas/public_api/v4/commits_details.json (limited to 'spec') diff --git a/spec/fixtures/api/schemas/public_api/v4/blobs.json b/spec/fixtures/api/schemas/public_api/v4/blobs.json index 9cb1eae3762..a812815838f 100644 --- a/spec/fixtures/api/schemas/public_api/v4/blobs.json +++ b/spec/fixtures/api/schemas/public_api/v4/blobs.json @@ -7,11 +7,12 @@ "data": { "type": "string" }, "filename": { "type": ["string"] }, "id": { "type": ["string", "null"] }, + "project_id": { "type": "integer" }, "ref": { "type": "string" }, "startline": { "type": "integer" } }, "required": [ - "basename", "data", "filename", "id", "ref", "startline" + "basename", "data", "filename", "id", "ref", "startline", "project_id" ], "additionalProperties": false } diff --git a/spec/fixtures/api/schemas/public_api/v4/commit/detail.json b/spec/fixtures/api/schemas/public_api/v4/commit/detail.json index 88a3cad62f6..477e776a804 100644 --- a/spec/fixtures/api/schemas/public_api/v4/commit/detail.json +++ b/spec/fixtures/api/schemas/public_api/v4/commit/detail.json @@ -4,9 +4,9 @@ { "$ref": "basic.json" }, { "required" : [ - "stats", "status", - "last_pipeline" + "last_pipeline", + "project_id" ], "properties": { "stats": { "$ref": "../commit_stats.json" }, @@ -16,7 +16,8 @@ { "type": "null" }, { "$ref": "../pipeline/basic.json" } ] - } + }, + "project_id": { "type": "integer" } } } ] diff --git a/spec/fixtures/api/schemas/public_api/v4/commits_details.json b/spec/fixtures/api/schemas/public_api/v4/commits_details.json new file mode 100644 index 00000000000..1f5b1ad86ef --- /dev/null +++ b/spec/fixtures/api/schemas/public_api/v4/commits_details.json @@ -0,0 +1,4 @@ +{ + "type": "array", + "items": { "$ref": "commit/detail.json" } +} diff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rb index ddda5752f0c..9052a18c60b 100644 --- a/spec/requests/api/search_spec.rb +++ b/spec/requests/api/search_spec.rb @@ -295,7 +295,7 @@ describe API::Search do get api("/projects/#{repo_project.id}/-/search", user), scope: 'commits', search: '498214de67004b1da3d820901307bed2a68a8ef6' end - it_behaves_like 'response is correct', schema: 'public_api/v4/commits' + it_behaves_like 'response is correct', schema: 'public_api/v4/commits_details' end context 'for commits scope with project path as id' do @@ -303,7 +303,7 @@ describe API::Search do get api("/projects/#{CGI.escape(repo_project.full_path)}/-/search", user), scope: 'commits', search: '498214de67004b1da3d820901307bed2a68a8ef6' end - it_behaves_like 'response is correct', schema: 'public_api/v4/commits' + it_behaves_like 'response is correct', schema: 'public_api/v4/commits_details' end context 'for blobs scope' do -- cgit v1.2.1