From cccf846571b4cd7c5f46244e4d7d0720af95bbbb Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Wed, 15 Aug 2018 16:19:14 +0900 Subject: Fix spec --- spec/uploaders/object_storage_spec.rb | 28 +++++++++++++++------------- 1 file 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 -- cgit v1.2.1