From 97d98113e7d05244e7bfa611610ab4fdde517d64 Mon Sep 17 00:00:00 2001 From: geemus Date: Thu, 21 Jul 2011 10:16:31 -0500 Subject: [PATCH] [storage|ninefold] fix file#destroy and test cleanup --- lib/fog/storage/models/ninefold/file.rb | 2 +- .../models/ninefold/file_update_tests.rb | 31 ++++++------ .../ninefold/nested_directories_tests.rb | 50 ++++++++----------- 3 files changed, 40 insertions(+), 43 deletions(-) diff --git a/lib/fog/storage/models/ninefold/file.rb b/lib/fog/storage/models/ninefold/file.rb index e8781f036..2605a66bc 100644 --- a/lib/fog/storage/models/ninefold/file.rb +++ b/lib/fog/storage/models/ninefold/file.rb @@ -30,7 +30,7 @@ module Fog def destroy requires :directory, :key - connection.delete_namespace(directory.key + key) + connection.delete_namespace([directory.key, key].join('/')) true end diff --git a/tests/storage/models/ninefold/file_update_tests.rb b/tests/storage/models/ninefold/file_update_tests.rb index b4654b0ec..1a4fae86a 100644 --- a/tests/storage/models/ninefold/file_update_tests.rb +++ b/tests/storage/models/ninefold/file_update_tests.rb @@ -1,16 +1,19 @@ -if storage_providers.keys.include? :ninefold - for provider, config in storage_providers - - Shindo.tests("Storage[:ninefold] | nested directories", [provider]) do - ninefold = Fog::Storage[:ninefold] - tests("update a file").succeeds do - pending if Fog.mocking? - dir = ninefold.directories.create(:key => 'updatefiletests') - f = dir.files.create(:key => 'lorem.txt', :body => lorem_file) - f.body = "xxxxxx" - f.save - end - end +Shindo.tests("Storage[:ninefold] | nested directories", ['ninefold']) do + unless Fog.mocking? + @directory = Fog::Storage[:ninefold].directories.create(:key => 'updatefiletests') end -end + + ninefold = Fog::Storage[:ninefold] + tests("update a file").succeeds do + pending if Fog.mocking? + file = @directory.files.create(:key => 'lorem.txt', :body => lorem_file) + file.body = "xxxxxx" + file.save + end + + unless Fog.mocking? + @directory.destroy(:recursive => true) + end + +end \ No newline at end of file diff --git a/tests/storage/models/ninefold/nested_directories_tests.rb b/tests/storage/models/ninefold/nested_directories_tests.rb index 112f94ee0..ad0de9e87 100644 --- a/tests/storage/models/ninefold/nested_directories_tests.rb +++ b/tests/storage/models/ninefold/nested_directories_tests.rb @@ -1,29 +1,23 @@ -if storage_providers.keys.include? :ninefold - for provider, config in storage_providers - - Shindo.tests("Storage[:ninefold] | nested directories", [provider]) do - ninefold = Fog::Storage[:ninefold] - tests("create a directory with a / character").succeeds do - pending if Fog.mocking? - ninefold.directories.create(:key => 'sub/path') - end - - tests("List of top directory returns sub dir").returns(1) do - pending if Fog.mocking? - ninefold.directories.get('sub').directories.count - end - - tests("create a directory in a sub dir").returns('sub/path/newdir/') do - pending if Fog.mocking? - ninefold.directories.get('sub/path').directories.create(:key => 'newdir').identity - end - - tests("Recursively destroy parent dir").succeeds do - pending if Fog.mocking? - ninefold.directories.get('sub').destroy(:recursive => true) - end - - end - +Shindo.tests("Storage[:ninefold] | nested directories", ['ninefold']) do + ninefold = Fog::Storage[:ninefold] + tests("create a directory with a / character").succeeds do + pending if Fog.mocking? + ninefold.directories.create(:key => 'sub/path') end -end + + tests("List of top directory returns sub dir").returns(1) do + pending if Fog.mocking? + ninefold.directories.get('sub').directories.count + end + + tests("create a directory in a sub dir").returns('sub/path/newdir/') do + pending if Fog.mocking? + ninefold.directories.get('sub/path').directories.create(:key => 'newdir').identity + end + + tests("Recursively destroy parent dir").succeeds do + pending if Fog.mocking? + ninefold.directories.get('sub').destroy(:recursive => true) + end + +end \ No newline at end of file