From 7e9c479f7de77702622631cff2628a9c8dcbc627 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 Nov 2020 08:27:35 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-6-stable-ee --- spec/uploaders/gitlab_uploader_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'spec/uploaders/gitlab_uploader_spec.rb') diff --git a/spec/uploaders/gitlab_uploader_spec.rb b/spec/uploaders/gitlab_uploader_spec.rb index 72845b47a53..4e661e458ad 100644 --- a/spec/uploaders/gitlab_uploader_spec.rb +++ b/spec/uploaders/gitlab_uploader_spec.rb @@ -141,5 +141,23 @@ RSpec.describe GitlabUploader do end end end + + describe '#url_or_file_path' do + let(:options) { { expire_at: 1.day.from_now } } + + it 'returns url when in remote storage' do + expect(subject).to receive(:file_storage?).and_return(false) + expect(subject).to receive(:url).with(options).and_return("http://example.com") + + expect(subject.url_or_file_path(options)).to eq("http://example.com") + end + + it 'returns url when in remote storage' do + expect(subject).to receive(:file_storage?).and_return(true) + expect(subject).to receive(:path).and_return("/tmp/file") + + expect(subject.url_or_file_path(options)).to eq("file:///tmp/file") + end + end end end -- cgit v1.2.3