class Qeweney::MockAdapter
def self.mock(headers = {}, request_body = nil)
def self.mock(headers = {}, request_body = nil) headers[':method'] ||= '' headers[':path'] ||= '' Request.new(headers, new(request_body)) end
def complete?(_req)
def complete?(_req) @request_body_chunks.empty? end
def get_body(_req)
def get_body(_req) body = @request_body_chunks.join('') @request_body_chunks.clear body end
def get_body_chunk(_req, _buffered_only)
def get_body_chunk(_req, _buffered_only) @request_body_chunks.shift end
def initialize(request_body)
def initialize(request_body) case request_body when Array @request_body_chunks = request_body when nil @request_body_chunks = [] else @request_body_chunks = [request_body] end @calls = [] end
def method_missing(sym, *args)
def method_missing(sym, *args) calls << [sym, *args] end
def respond(req, body, headers)
def respond(req, body, headers) @calls << [:respond, req, body, headers] @body = body @headers = headers end
def status
def status headers[':status'] || Qeweney::Status::OK end