diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2017-06-05 09:58:37 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-06-08 14:36:42 +0300 |
commit | da1ed066cfb2328598a9765794dfa71f2f8a786b (patch) | |
tree | 813aa35573f532af62667cdc948e9bdd082a6d16 /spec | |
parent | aa28fa4e859ff9d6eaac94e2303da4080eb9d498 (diff) |
Merge branch 'sh-fix-lfs-from-moving-across-filesystems' into 'master'
Fix LFS timeouts when trying to save large files
Closes #33218
See merge request !11866
Diffstat (limited to 'spec')
-rw-r--r-- | spec/uploaders/lfs_object_uploader_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/uploaders/lfs_object_uploader_spec.rb b/spec/uploaders/lfs_object_uploader_spec.rb new file mode 100644 index 00000000000..c3b72e7d677 --- /dev/null +++ b/spec/uploaders/lfs_object_uploader_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe LfsObjectUploader do + let(:uploader) { described_class.new(build_stubbed(:empty_project)) } + + describe '#cache!' do + it 'caches the file in the cache directory' do + # One to get the work dir, the other to remove it + expect(uploader).to receive(:workfile_path).exactly(2).times.and_call_original + expect(FileUtils).to receive(:mv).with(anything, /^#{uploader.work_dir}/).and_call_original + expect(FileUtils).to receive(:mv).with(/^#{uploader.work_dir}/, /^#{uploader.cache_dir}/).and_call_original + + fixture = Rails.root.join('spec', 'fixtures', 'rails_sample.jpg') + uploader.cache!(fixture_file_upload(fixture)) + + expect(uploader.file.path).to start_with(uploader.cache_dir) + end + end + + describe '#move_to_cache' do + it 'is true' do + expect(uploader.move_to_cache).to eq(true) + end + end + + describe '#move_to_store' do + it 'is true' do + expect(uploader.move_to_store).to eq(true) + end + end +end |