1
# Rack 1.0 does not allow string subclass body. This does not play well with our ActionView::SafeBuffer.
2
# The next release of Rack will be allowing string subclass body - http://github.com/rack/rack/commit/de668df02802a0335376a81ba709270e43ba9d55
3
# TODO : Remove this monkey patch after the next release of Rack
6
module AllowStringSubclass
7
def self.included(base)
8
base.send :alias_method, :each, :each_with_hack
15
assert("Body yielded non-string value #{part.inspect}") {
21
if @body.respond_to?(:to_path)
22
assert("The file identified by body.to_path does not exist") {
23
::File.exist? @body.to_path
30
app = proc {|env| [200, {"Content-Type" => "text/plain", "Content-Length" => "12"}, [Class.new(String).new("Hello World!")]] }
31
response = Rack::MockRequest.new(Rack::Lint.new(app)).get('/')
32
rescue Rack::Lint::LintError => e
33
raise(e) unless e.message =~ /Body yielded non-string value/
34
Rack::Lint.send :include, AllowStringSubclass