lib/fog/rackspace/requests/queues/create_queue.rb in fog-maestrodev-1.19.0.20140212012611 vs lib/fog/rackspace/requests/queues/create_queue.rb in fog-maestrodev-1.20.0.20140305101305

- old
+ new

@@ -1,10 +1,10 @@ module Fog module Rackspace class Queues - class Real + class Real # This operation creates a new queue. # The body of the request is empty. # # @param [String] queue_name Specifies the name of the queue. # @return [Excon::Response] response @@ -20,8 +20,22 @@ :method => 'PUT', :path => "queues/#{queue_name}" ) end end + + class Mock + def create_queue(queue_name) + raise MethodNotAllowed.new if queue_name.nil? || queue_name.empty? + + existed = ! mock_queue(queue_name).nil? + add_queue(queue_name) unless existed + + response = Excon::Response.new + response.status = existed ? 201 : 204 + response + end + end + end end end