Class: Dupe::Network::PutMock

Inherits:
Mock
  • Object
show all
Defined in:
lib/superdupe/mock.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Mock

#response, #url_pattern

Instance Method Summary collapse

Methods inherited from Mock

#initialize, #match?, #mocked_response

Constructor Details

This class inherits a constructor from Dupe::Network::Mock

Instance Method Details

#process_response(resp, url) ⇒ Object

returns a tuple representing the xml of the processed entity, plus the url to the entity.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/superdupe/mock.rb', line 97

def process_response(resp, url)
  case resp
    
    when NilClass
      raise StandardError, "Failed with 500: the request '#{url}' returned nil." 
    
    when Dupe::Database::Record
      resp = nil
      Dupe.network.log.add_request :put, url, ""
      return resp, url
    
    else
      raise StandardError, "Unknown PutMock Response. Your Post intercept mocks must return a Duped resource object or nil"
  end
end