Object
# File lib/active_resource/persistent_http_mock.rb, line 25 def self.enabled=(bool) @enabled = bool end
# File lib/active_resource/persistent_http_mock.rb, line 28 def self.enabled? @enabled end
# File lib/active_resource/persistent_http_mock.rb, line 57 def patch(path, body, headers) request = ActiveResource::Request.new(:patch, path, body, headers) self.class.requests << request if response = self.class.responses.assoc(request) response[1] else raise InvalidRequestError.new("Could not find a response recorded for \#{request.to_s} - Responses recorded are: \#{inspect_responses}") end end
# File lib/active_resource/persistent_http_mock.rb, line 31 def request(uri, req) headers = {} req.each_capitalized{ |k,v| headers[k] = v unless k == 'Accept' && v == '*/*' } request = ActiveResource::Request.new(req.method.downcase.to_sym, req.path, req.request_body_permitted? ? req.body : nil, headers) self.class.requests << request if response = self.class.responses.assoc(request) response[1] else raise ActiveResource::InvalidRequestError.new("Could not find a response recorded for\n #{request.inspect}\n - Responses recorded are:\n #{self.class.responses.map{|r| r.inspect}.join("\n ")}") end end
Generated with the Darkfish Rdoc Generator 2.