2013-02-13 10:11:10 -05:00
|
|
|
Shindo.tests('Fog::Rackspace::Storage | directories', ['rackspace']) do
|
|
|
|
|
|
|
|
@service = Fog::Storage[:rackspace]
|
|
|
|
|
|
|
|
begin
|
|
|
|
@name = "fog-directories-test-#{Time.now.to_i.to_s}"
|
|
|
|
@filename = 'lorem.txt'
|
|
|
|
@dir = @service.directories.create :key => @name, :metadata => {:fog_test => true}
|
|
|
|
@file = @dir.files.create :key => @filename, :body => lorem_file
|
|
|
|
|
|
|
|
tests('#get').succeeds do
|
|
|
|
instance = @service.directories.get @name
|
|
|
|
returns(false) { instance.nil? }
|
2013-02-25 10:54:34 -05:00
|
|
|
returns('true') { instance.metadata[:fog_test] }
|
2013-02-13 10:11:10 -05:00
|
|
|
returns(@name) { instance.key }
|
|
|
|
returns(1) { instance.count }
|
|
|
|
returns( Fog::Storage.get_body_size(lorem_file)) {instance.bytes }
|
|
|
|
returns(@filename) { instance.files.first.key }
|
2013-02-14 10:56:57 -05:00
|
|
|
end
|
|
|
|
|
2013-02-13 10:11:10 -05:00
|
|
|
ensure
|
|
|
|
@file.destroy if @file
|
|
|
|
@dir.destroy if @dir
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|