ActiveVault::Site::MirrorSite#url
This commit is contained in:
parent
abda6d784e
commit
5869045f2e
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user