summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-08-15 16:19:14 +0900
committerShinya Maeda <shinya@gitlab.com>2018-11-19 14:33:30 +0900
commitcccf846571b4cd7c5f46244e4d7d0720af95bbbb (patch)
treec45f77791ea9ea4125c722d44460c3d4da2f0f60
parent4b09ece71d0e8bfc0562d599641a60a46feb8b50 (diff)
downloadgitlab-ce-caching-file-in-use-file-always.tar.gz
-rw-r--r--spec/uploaders/object_storage_spec.rb28
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