diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-03 17:34:14 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-04 23:13:45 +0200 |
commit | 9dde7df2470cc3fe7989de163fe3985d53262a0d (patch) | |
tree | 2214d86cdd95c4af5ae91dd5ec3b07a8be14df0f /spec/uploaders | |
parent | eaed588bf228c833cb666a61bc7d25cf21d5f94b (diff) | |
download | gitlab-ce-9dde7df2470cc3fe7989de163fe3985d53262a0d.tar.gz |
Allow to store uploads by default on Object Storagedirect-upload-of-uploads
Introduce `direct_upload` option for `uploads` which is gonna set a default storage to Object Storage and use Unicorn to save data
Diffstat (limited to 'spec/uploaders')
-rw-r--r-- | spec/uploaders/object_storage_spec.rb | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/spec/uploaders/object_storage_spec.rb b/spec/uploaders/object_storage_spec.rb index 59e02fecbce..17d508d0146 100644 --- a/spec/uploaders/object_storage_spec.rb +++ b/spec/uploaders/object_storage_spec.rb @@ -62,10 +62,12 @@ describe ObjectStorage do end describe '#object_store' do + subject { uploader.object_store } + it "delegates to <mount>_store on model" do expect(object).to receive(:file_store) - uploader.object_store + subject end context 'when store is null' do @@ -73,8 +75,36 @@ describe ObjectStorage do expect(object).to receive(:file_store).and_return(nil) end - it "returns Store::LOCAL" do - expect(uploader.object_store).to eq(described_class::Store::LOCAL) + context 'when object storage is enabled' do + context 'when direct uploads are enabled' do + before do + stub_uploads_object_storage(uploader_class, enabled: true, direct_upload: true) + end + + it "uses Store::REMOTE" do + is_expected.to eq(described_class::Store::REMOTE) + end + end + + context 'when direct uploads are disabled' do + before do + stub_uploads_object_storage(uploader_class, enabled: true, direct_upload: false) + end + + it "uses Store::LOCAL" do + is_expected.to eq(described_class::Store::LOCAL) + end + end + end + + context 'when object storage is disabled' do + before do + stub_uploads_object_storage(uploader_class, enabled: false) + end + + it "uses Store::LOCAL" do + is_expected.to eq(described_class::Store::LOCAL) + end end end @@ -84,7 +114,7 @@ describe ObjectStorage do end it "returns the given value" do - expect(uploader.object_store).to eq(described_class::Store::REMOTE) + is_expected.to eq(described_class::Store::REMOTE) end end end |