In Files

Parent

Methods

Included Modules

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

(Not documented)

     # File lib/rack/mock.rb, line 118
118:     def initialize(status, headers, body, errors=StringIO.new(""))
119:       @status = status.to_i
120: 
121:       @original_headers = headers
122:       @headers = Rack::Utils::HeaderHash.new
123:       headers.each { |field, values|
124:         @headers[field] = values
125:         @headers[field] = ""  if values.empty?
126:       }
127: 
128:       @body = ""
129:       body.each { |part| @body << part }
130: 
131:       @errors = errors.string
132:     end

Public Instance Methods

=~(other) click to toggle source

(Not documented)

     # File lib/rack/mock.rb, line 148
148:     def =~(other)
149:       @body =~ other
150:     end
[](field) click to toggle source

(Not documented)

     # File lib/rack/mock.rb, line 140
140:     def [](field)
141:       headers[field]
142:     end
match(other) click to toggle source

(Not documented)

     # File lib/rack/mock.rb, line 152
152:     def match(other)
153:       @body.match other
154:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.