summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael S. Klishin <michael@novemberain.com>2008-09-05 22:22:16 +0300
committerChristian Neukirchen <chneukirchen@gmail.com>2008-09-05 21:33:12 +0200
commit92f79ea8def92c3c2373b9ab5f5fa8e03aa7669d (patch)
treed6e45f8a6c80ad8b32d1e1322465e8c6bfd17efd
parente33cc65a013952935c6bb70e24f359023c075e84 (diff)
downloadrack-0.4.tar.gz
Make Rack::Lint::InputWrapper delegate size method to underlying IO object.rack-0.4
See http://snurl.com/3nesq: Lint was breaking file uploads in a Merb app. Signed-off-by: Michael S. Klishin <michael@novemberain.com>
-rw-r--r--lib/rack/lint.rb4
-rw-r--r--test/spec_rack_lint.rb12
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/rack/lint.rb b/lib/rack/lint.rb
index 7bc433b8..79bd9c02 100644
--- a/lib/rack/lint.rb
+++ b/lib/rack/lint.rb
@@ -215,6 +215,10 @@ module Rack
@input = input
end
+ def size
+ @input.size
+ end
+
## * +gets+ must be called without arguments and return a string,
## or +nil+ on EOF.
def gets(*args)
diff --git a/test/spec_rack_lint.rb b/test/spec_rack_lint.rb
index dbb6687e..3d8c2edb 100644
--- a/test/spec_rack_lint.rb
+++ b/test/spec_rack_lint.rb
@@ -299,5 +299,17 @@ context "Rack::Lint" do
}.should.raise(Rack::Lint::LintError).
message.should.match(/close must not be called/)
end
+end
+context "Rack::Lint::InputWrapper" do
+ specify "delegates :size to underlying IO object" do
+ class IOMock
+ def size
+ 101
+ end
+ end
+
+ wrapper = Rack::Lint::InputWrapper.new(IOMock.new)
+ wrapper.size.should == 101
+ end
end