提交 5869045f 编写于 作者: G George Claghorn

ActiveVault::Site::MirrorSite#url

上级 abda6d78
......@@ -9,7 +9,7 @@ def upload(key, io)
sites.collect do |site|
site.upload key, io
io.rewind
end
end
end
def download(key)
......@@ -25,6 +25,10 @@ def exist?(key)
end
def url(key, **options)
primary_site.url(key, **options)
end
def byte_size(key)
primary_site.byte_size(key)
end
......@@ -42,6 +46,6 @@ def perform_across_sites(method, *args)
# FIXME: Convert to be threaded
sites.collect do |site|
site.public_send method, *args
end
end
end
end
......@@ -9,7 +9,7 @@ class ActiveVault::Site::MirrorSiteTest < ActiveSupport::TestCase
include ActiveVault::Site::SharedSiteTests
test "uploading was done to all sites" do
test "uploading to all sites" do
begin
key = SecureRandom.base58(24)
data = "Something else entirely!"
......@@ -27,4 +27,11 @@ class ActiveVault::Site::MirrorSiteTest < ActiveSupport::TestCase
assert PRIMARY_DISK_SITE.exist?(FIXTURE_KEY)
assert SECONDARY_DISK_SITE.exist?(FIXTURE_KEY)
end
test "URL generation for primary site" do
travel_to Time.now do
assert_equal PRIMARY_DISK_SITE.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: "test.txt"),
SITE.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: "test.txt")
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册