summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 03:07:52 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 03:07:52 +0000
commita0c1ba61c8e8c9195e3ad4deefc5c4cb5c6a1501 (patch)
tree0731210fac047fdfb04a8e907701e0efab8c897e /spec/requests
parent77237c5a6b9044f58beabc54d3589e5fa09cbfba (diff)
downloadgitlab-ce-a0c1ba61c8e8c9195e3ad4deefc5c4cb5c6a1501.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/lfs_http_spec.rb32
1 files changed, 22 insertions, 10 deletions
diff --git a/spec/requests/lfs_http_spec.rb b/spec/requests/lfs_http_spec.rb
index c6403a6ab75..c71b803a7ab 100644
--- a/spec/requests/lfs_http_spec.rb
+++ b/spec/requests/lfs_http_spec.rb
@@ -690,22 +690,34 @@ describe 'Git LFS API and storage' do
end
context 'when pushing an LFS object that already exists' do
+ shared_examples_for 'batch upload with existing LFS object' do
+ it_behaves_like 'LFS http 200 response'
+
+ it 'responds with links the object to the project' do
+ expect(json_response['objects']).to be_kind_of(Array)
+ expect(json_response['objects'].first).to include(sample_object)
+ expect(lfs_object.projects.pluck(:id)).not_to include(project.id)
+ expect(lfs_object.projects.pluck(:id)).to include(other_project.id)
+ expect(json_response['objects'].first['actions']['upload']['href']).to eq(objects_url(project, sample_oid, sample_size))
+ expect(json_response['objects'].first['actions']['upload']['header']).to include('Content-Type' => 'application/octet-stream')
+ end
+
+ it_behaves_like 'process authorization header', renew_authorization: true
+ end
+
let(:update_lfs_permissions) do
other_project.lfs_objects << lfs_object
end
- it_behaves_like 'LFS http 200 response'
-
- it 'responds with links the object to the project' do
- expect(json_response['objects']).to be_kind_of(Array)
- expect(json_response['objects'].first).to include(sample_object)
- expect(lfs_object.projects.pluck(:id)).not_to include(project.id)
- expect(lfs_object.projects.pluck(:id)).to include(other_project.id)
- expect(json_response['objects'].first['actions']['upload']['href']).to eq(objects_url(project, sample_oid, sample_size))
- expect(json_response['objects'].first['actions']['upload']['header']).to include('Content-Type' => 'application/octet-stream')
+ context 'in another project' do
+ it_behaves_like 'batch upload with existing LFS object'
end
- it_behaves_like 'process authorization header', renew_authorization: true
+ context 'in source of fork project' do
+ let(:project) { fork_project(other_project) }
+
+ it_behaves_like 'batch upload with existing LFS object'
+ end
end
context 'when pushing a LFS object that does not exist' do