Class | Rack::MockResponse |
In: |
lib/rack/mock.rb
|
Parent: | Object |
Rack::MockResponse provides useful helpers for testing your apps. Usually, you don‘t create the MockResponse on your own, but use MockRequest.
body | [R] | Body |
errors | [RW] | Errors |
headers | [R] | Headers |
original_headers | [R] | Headers |
status | [R] | Status |
# File lib/rack/mock.rb, line 113 113: def initialize(status, headers, body, errors=StringIO.new("")) 114: @status = status.to_i 115: 116: @original_headers = headers 117: @headers = Rack::Utils::HeaderHash.new 118: headers.each { |field, values| 119: values.each { |value| 120: @headers[field] = value 121: } 122: @headers[field] = "" if values.empty? 123: } 124: 125: @body = "" 126: body.each { |part| @body << part } 127: 128: @errors = errors.string 129: end