mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[S3] File#url calls Files#get_url with self.key.
This commit is contained in:
parent
400d2b710f
commit
452e498d72
2 changed files with 20 additions and 0 deletions
|
@ -66,6 +66,11 @@ module Fog
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def url(expires)
|
||||||
|
requires :key
|
||||||
|
collection.get_url(key, expires)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def directory=(new_directory)
|
def directory=(new_directory)
|
||||||
|
|
|
@ -103,4 +103,19 @@ describe 'Fog::AWS::S3::File' do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#url" do
|
||||||
|
|
||||||
|
it "should return a signed expiring url" do
|
||||||
|
data = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||||
|
file = @directory.files.create(:key => 'fogfilename', :body => data)
|
||||||
|
url = file.url(Time.now + 60 * 10)
|
||||||
|
url.should include("fogfilename", "Expires")
|
||||||
|
unless Fog.mocking?
|
||||||
|
open(url).read.should == File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r').read
|
||||||
|
end
|
||||||
|
file.destroy
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue