Commit d82cc493 authored by Micaël Bergeron's avatar Micaël Bergeron

add #url monkey patch to return https:// private urls

parent d2d0aa4d
module Fog
module Storage
class GoogleXML
class File < Fog::Model
module MonkeyPatch
# Monkey patch this to use `get_https_url`
def url(expires)
requires :key
collection.get_https_url(key, expires)
end
end
prepend MonkeyPatch
end
end
end
end
require 'spec_helper'
describe Fog::Storage::GoogleXML::File do
let(:storage) do
Fog.mock!
Fog::Storage.new({
google_storage_access_key_id: "asdf",
google_storage_secret_access_key: "asdf",
provider: "Google"
})
end
let(:file) do
directory = storage.directories.create(key: 'data')
directory.files.create(
body: 'Hello World!',
key: 'hello_world.txt'
)
end
it 'delegates to #get_https_url' do
expect(file.url(Time.now)).to start_with("https://")
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment