diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2017-11-21 18:34:00 +0100 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2017-11-21 18:38:25 +0100 |
commit | d087b4dac466fc7da6dbdc8668aea943af4546e8 (patch) | |
tree | 55fecf2aad3c464f699ba691ca252a88a6c7fb10 /spec/uploaders | |
parent | a4072db0198896242886d22c644ed91c1016aa8d (diff) | |
download | gitlab-ce-d087b4dac466fc7da6dbdc8668aea943af4546e8.tar.gz |
FileUploader should check for hashed_storage?(:attachments) to use disk_path
Diffstat (limited to 'spec/uploaders')
-rw-r--r-- | spec/uploaders/file_uploader_spec.rb | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/spec/uploaders/file_uploader_spec.rb b/spec/uploaders/file_uploader_spec.rb index f52b2bab05b..fd195d6f9b8 100644 --- a/spec/uploaders/file_uploader_spec.rb +++ b/spec/uploaders/file_uploader_spec.rb @@ -28,25 +28,51 @@ describe FileUploader do end context 'hashed storage' do - let(:project) { build_stubbed(:project, :hashed) } + context 'when rolled out attachments' do + let(:project) { build_stubbed(:project, :hashed) } - describe '.absolute_path' do - it 'returns the correct absolute path by building it dynamically' do - upload = double(model: project, path: 'secret/foo.jpg') + describe '.absolute_path' do + it 'returns the correct absolute path by building it dynamically' do + upload = double(model: project, path: 'secret/foo.jpg') - dynamic_segment = project.disk_path + dynamic_segment = project.disk_path - expect(described_class.absolute_path(upload)) - .to end_with("#{dynamic_segment}/secret/foo.jpg") + expect(described_class.absolute_path(upload)) + .to end_with("#{dynamic_segment}/secret/foo.jpg") + end + end + + describe "#store_dir" do + it "stores in the namespace path" do + uploader = described_class.new(project) + + expect(uploader.store_dir).to include(project.disk_path) + expect(uploader.store_dir).not_to include("system") + end end end - describe "#store_dir" do - it "stores in the namespace path" do - uploader = described_class.new(project) + context 'when only repositories are rolled out' do + let(:project) { build_stubbed(:project, storage_version: Project::HASHED_STORAGE_FEATURES[:repository]) } - expect(uploader.store_dir).to include(project.disk_path) - expect(uploader.store_dir).not_to include("system") + describe '.absolute_path' do + it 'returns the correct absolute path by building it dynamically' do + upload = double(model: project, path: 'secret/foo.jpg') + + dynamic_segment = project.full_path + + expect(described_class.absolute_path(upload)) + .to end_with("#{dynamic_segment}/secret/foo.jpg") + end + end + + describe "#store_dir" do + it "stores in the namespace path" do + uploader = described_class.new(project) + + expect(uploader.store_dir).to include(project.full_path) + expect(uploader.store_dir).not_to include("system") + end end end end |