Rack::MockResponse provides useful helpers for testing your apps. Usually, you don’t create the MockResponse on your own, but use MockRequest.
# 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
# File lib/rack/mock.rb, line 163 163: def =~(other) 164: body =~ other 165: end
# 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
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.