Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/projects/lfs_pointers/lfs_download_service_spec.rb')
-rw-r--r--spec/services/projects/lfs_pointers/lfs_download_service_spec.rb27
1 files changed, 15 insertions, 12 deletions
diff --git a/spec/services/projects/lfs_pointers/lfs_download_service_spec.rb b/spec/services/projects/lfs_pointers/lfs_download_service_spec.rb
index 21a139cdf3c..496d1fe67f2 100644
--- a/spec/services/projects/lfs_pointers/lfs_download_service_spec.rb
+++ b/spec/services/projects/lfs_pointers/lfs_download_service_spec.rb
@@ -134,6 +134,21 @@ describe Projects::LfsPointers::LfsDownloadService do
end
end
+ context 'when an lfs object with the same oid already exists' do
+ let!(:existing_lfs_object) { create(:lfs_object, oid: oid) }
+
+ before do
+ stub_full_request(download_link).to_return(body: lfs_content)
+ end
+
+ it_behaves_like 'no lfs object is created'
+
+ it 'does not update the file attached to the existing LfsObject' do
+ expect { subject.execute }
+ .not_to change { existing_lfs_object.reload.file.file.file }
+ end
+ end
+
context 'when credentials present' do
let(:download_link_with_credentials) { "http://user:password@gitlab.com/#{oid}" }
let(:lfs_object) { LfsDownloadObject.new(oid: oid, size: size, link: download_link_with_credentials) }
@@ -211,17 +226,5 @@ describe Projects::LfsPointers::LfsDownloadService do
subject.execute
end
end
-
- context 'when an lfs object with the same oid already exists' do
- before do
- create(:lfs_object, oid: oid)
- end
-
- it 'does not download the file' do
- expect(subject).not_to receive(:download_lfs_file!)
-
- subject.execute
- end
- end
end
end