diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-17 18:09:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-17 18:09:28 +0300 |
commit | 6535cf9c79362862c31ea7d26c61541b84db18d9 (patch) | |
tree | 6d646edcf11d38e8ac23bceed1340ff8907b850d /spec/uploaders/gitlab_uploader_spec.rb | |
parent | 9a8f801d7352b7965fe690a599410fb50005ce67 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/uploaders/gitlab_uploader_spec.rb')
-rw-r--r-- | spec/uploaders/gitlab_uploader_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
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 |