mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: fallback to local store when uploads are not on S3
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
require 'spec_helper'
|
||||
require 'file_store/s3_store'
|
||||
require 'file_store/local_store'
|
||||
|
||||
describe FileStore::S3Store do
|
||||
|
||||
@ -105,4 +106,23 @@ describe FileStore::S3Store do
|
||||
|
||||
end
|
||||
|
||||
describe ".path_for" do
|
||||
|
||||
def assert_path(path, expected)
|
||||
upload = Upload.new(url: path)
|
||||
|
||||
path = store.path_for(upload)
|
||||
expected = FileStore::LocalStore.new.path_for(upload) if expected
|
||||
|
||||
expect(path).to eq(expected)
|
||||
end
|
||||
|
||||
it "correctly falls back to local" do
|
||||
assert_path("/hello", "/hello")
|
||||
assert_path("//hello", nil)
|
||||
assert_path("http://hello", nil)
|
||||
assert_path("https://hello", nil)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user