Rack::MockResponse provides useful helpers for testing your apps. Usually, you don’t create the MockResponse on your own, but use MockRequest.
Body
Errors
Headers
Headers
Status
# File lib/rack/mock.rb, line 145 def initialize(status, headers, body, errors=StringIO.new("")) @status = status.to_i @original_headers = headers @headers = Rack::Utils::HeaderHash.new headers.each { |field, values| @headers[field] = values @headers[field] = "" if values.empty? } @body = "" body.each { |part| @body << part } @errors = errors.string if errors.respond_to?(:string) end
# File lib/rack/mock.rb, line 175 def =~(other) @body =~ other end
# File lib/rack/mock.rb, line 167 def [](field) headers[field] end
# File lib/rack/mock.rb, line 179 def match(other) @body.match other end