Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/uploaders/gitlab_uploader_spec.rb')
-rw-r--r--spec/uploaders/gitlab_uploader_spec.rb18
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