FIX: fallback to local store when uploads are not on S3

This commit is contained in:
Sam
2015-05-26 13:08:31 +10:00
parent eeda367e70
commit e17f614771
2 changed files with 28 additions and 0 deletions

View File

@ -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