Class: Qeweney::TestAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/qeweney/test_adapter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



5
6
7
# File 'lib/qeweney/test_adapter.rb', line 5

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



5
6
7
# File 'lib/qeweney/test_adapter.rb', line 5

def headers
  @headers
end

Class Method Details

.mock(headers = {}) ⇒ Object



20
21
22
23
24
# File 'lib/qeweney/test_adapter.rb', line 20

def self.mock(headers = {})
  headers[':method'] ||= ''
  headers[':path'] ||= ''
  Request.new(headers, new)
end

Instance Method Details

#get_body_chunkObject



7
8
9
# File 'lib/qeweney/test_adapter.rb', line 7

def get_body_chunk
  nil
end

#respond(req, body, headers) ⇒ Object



11
12
13
14
# File 'lib/qeweney/test_adapter.rb', line 11

def respond(req, body, headers)
  @body = body
  @headers = headers
end

#statusObject



16
17
18
# File 'lib/qeweney/test_adapter.rb', line 16

def status
  headers[':status'] || Qeweney::Status::OK
end