In Files

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

original_headers[R]

Headers

errors[RW]

Errors

Public Class Methods

new(status, headers, body, errors=StringIO.new("")) click to toggle source
     # File lib/rack/mock.rb, line 155
155:     def initialize(status, headers, body, errors=StringIO.new(""))
156:       @original_headers = headers
157:       @errors           = errors.string if errors.respond_to?(:string)
158:       @body_string      = nil
159: 
160:       super(body, status, headers)
161:     end

Public Instance Methods

=~(other) click to toggle source
     # File lib/rack/mock.rb, line 163
163:     def =~(other)
164:       body =~ other
165:     end
body() click to toggle source
     # File lib/rack/mock.rb, line 171
171:     def body
172:       # FIXME: apparently users of MockResponse expect the return value of
173:       # MockResponse#body to be a string.  However, the real response object
174:       # returns the body as a list.
175:       #
176:       # See spec_showstatus.rb:
177:       #
178:       #   should "not replace existing messages" do
179:       #     ...
180:       #     res.body.should == "foo!"
181:       #   end
182:       super.join
183:     end
empty?() click to toggle source
     # File lib/rack/mock.rb, line 185
185:     def empty?
186:       [201, 204, 205, 304].include? status
187:     end
match(other) click to toggle source
     # File lib/rack/mock.rb, line 167
167:     def match(other)
168:       body.match other
169:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.