class 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
Errors
Headers
Public Class Methods
Source
# File lib/rack/mock.rb, line 184 def initialize(status, headers, body, errors = StringIO.new("")) @original_headers = headers @errors = errors.string if errors.respond_to?(:string) @cookies = parse_cookies_from_header super(body, status, headers) buffered_body! end
Calls superclass method
Rack::Response::new
Public Instance Methods
Source
# File lib/rack/mock.rb, line 202 def body # FIXME: apparently users of MockResponse expect the return value of # MockResponse#body to be a string. However, the real response object # returns the body as a list. # # See spec_showstatus.rb: # # should "not replace existing messages" do # ... # res.body.should == "foo!" # end buffer = String.new super.each do |chunk| buffer << chunk end return buffer end
Calls superclass method