In Files

Parent

Methods

Included Modules

Class Index [+]

Quicksearch

Rack::MockResponse

Rack::MockResponse provides useful helpers for testing your apps. Usually, you don’t create the MockResponse on your own, but use MockRequest.

Attributes

status[R]

Status

headers[R]

Headers

original_headers[R]

Headers

body[R]

Body

errors[RW]

Errors

Public Class Methods

new(status, headers, body, errors=StringIO.new("")) click to toggle source
     # File lib/rack/mock.rb, line 145
145:     def initialize(status, headers, body, errors=StringIO.new(""))
146:       @status = status.to_i
147: 
148:       @original_headers = headers
149:       @headers = Rack::Utils::HeaderHash.new
150:       headers.each { |field, values|
151:         @headers[field] = values
152:         @headers[field] = ""  if values.empty?
153:       }
154: 
155:       @body = ""
156:       body.each { |part| @body << part }
157: 
158:       @errors = errors.string if errors.respond_to?(:string)
159:     end

Public Instance Methods

=~(other) click to toggle source
     # File lib/rack/mock.rb, line 175
175:     def =~(other)
176:       @body =~ other
177:     end
[](field) click to toggle source
     # File lib/rack/mock.rb, line 167
167:     def [](field)
168:       headers[field]
169:     end
match(other) click to toggle source
     # File lib/rack/mock.rb, line 179
179:     def match(other)
180:       @body.match other
181:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.