1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/local/models/file_tests.rb

44 lines
1.3 KiB
Ruby
Raw Normal View History

Shindo.tests('Storage[:local] | file', ["local"]) do
pending if Fog.mocking?
2012-07-22 23:43:41 -04:00
before do
@options = { :local_root => '~/.fog' }
end
tests('#public_url') do
tests('when connection has an endpoint').
returns('http://example.com/files/directory/file.txt') do
@options[:endpoint] = 'http://example.com/files'
connection = Fog::Storage::Local.new(@options)
directory = connection.directories.new(:key => 'directory')
file = directory.files.new(:key => 'file.txt')
file.public_url
end
tests('when connection has no endpoint').
returns(nil) do
@options[:endpoint] = nil
connection = Fog::Storage::Local.new(@options)
directory = connection.directories.new(:key => 'directory')
file = directory.files.new(:key => 'file.txt')
file.public_url
end
tests('when file path has escapable characters').
returns('http://example.com/files/my%20directory/my%20file.txt') do
@options[:endpoint] = 'http://example.com/files'
connection = Fog::Storage::Local.new(@options)
directory = connection.directories.new(:key => 'my directory')
file = directory.files.new(:key => 'my file.txt')
file.public_url
end
end
end