diff --git a/lib/fog/rackspace/requests/storage/put_container.rb b/lib/fog/rackspace/requests/storage/put_container.rb index b7b1c94db..14d24ade5 100644 --- a/lib/fog/rackspace/requests/storage/put_container.rb +++ b/lib/fog/rackspace/requests/storage/put_container.rb @@ -21,6 +21,28 @@ module Fog end end + + class Mock + def put_container(name, options={}) + escaped = Fog::Rackspace.escape(name) + response = Excon::Response.new + meta = {} + options.keys.each do |k| + meta[k] = options[k] if k =~ /^X-Container-Meta/ + end + meta['X-Container-Object-Count'] = 0 + meta['X-Container-Bytes-Used'] = 0 + data[escaped] = { :meta => meta } + + if data.has_key?(escaped) + response.status = 202 # Accepted + else + response.status = 201 # Created + end + response + end + end + end end end diff --git a/tests/rackspace/requests/storage/container_tests.rb b/tests/rackspace/requests/storage/container_tests.rb index 846fbd9bb..2403da2da 100644 --- a/tests/rackspace/requests/storage/container_tests.rb +++ b/tests/rackspace/requests/storage/container_tests.rb @@ -11,7 +11,6 @@ Shindo.tests('Fog::Storage[:rackspace] | container requests', ["rackspace"]) do tests('success') do tests("#put_container('fogcontainertests', {})").succeeds do - pending if Fog.mocking? Fog::Storage[:rackspace].put_container('fogcontainertests') end