diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-08-15 16:19:14 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-11-19 14:33:30 +0900 |
commit | cccf846571b4cd7c5f46244e4d7d0720af95bbbb (patch) | |
tree | c45f77791ea9ea4125c722d44460c3d4da2f0f60 | |
parent | 4b09ece71d0e8bfc0562d599641a60a46feb8b50 (diff) | |
download | gitlab-ce-caching-file-in-use-file-always-ce.tar.gz |
-rw-r--r-- | spec/uploaders/object_storage_spec.rb | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/spec/uploaders/object_storage_spec.rb b/spec/uploaders/object_storage_spec.rb index 7e673681c31..93774344b1e 100644 --- a/spec/uploaders/object_storage_spec.rb +++ b/spec/uploaders/object_storage_spec.rb @@ -175,19 +175,7 @@ describe ObjectStorage do end describe '#use_file' do - context 'when file is stored locally' do - it "calls a regular path" do - expect { |b| uploader.use_file(&b) }.not_to yield_with_args(%r[tmp/cache]) - end - end - - context 'when file is stored remotely' do - let(:store) { described_class::Store::REMOTE } - - before do - stub_artifacts_object_storage - end - + shared_examples_for 'return cache file and cleanup' do it "calls a cache path" do expect { |b| uploader.use_file(&b) }.to yield_with_args(%r[tmp/cache]) end @@ -204,6 +192,20 @@ describe ObjectStorage do expect(File.exist?(cached_path)).to be_falsey end end + + context 'when file is stored locally' do + it_behaves_like 'return cache file and cleanup' + end + + context 'when file is stored remotely' do + let(:store) { described_class::Store::REMOTE } + + before do + stub_artifacts_object_storage + end + + it_behaves_like 'return cache file and cleanup' + end end describe '#migrate!' do |