summary refs log tree commit
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-12-23 21:22:50 -0600
committerJoshua Peek <josh@joshpeek.com>2008-12-23 21:37:26 -0600
commit61ce750c93cbe552bbf6b5c8af08c31a3f15489e (patch)
tree9b07945b3ef38b268b9dcfcdf00db1bd56563a03
parentea814ff1f14e1103215547d9d97487f63ef36f46 (diff)
downloadrack-61ce750c93cbe552bbf6b5c8af08c31a3f15489e.tar.gz
Delegate Lint::InputWrapper#rewind to underlying IO object
-rw-r--r--lib/rack/lint.rb8
-rw-r--r--test/spec_rack_lint.rb9
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/rack/lint.rb b/lib/rack/lint.rb
index b95f6f18..e7f805f1 100644
--- a/lib/rack/lint.rb
+++ b/lib/rack/lint.rb
@@ -29,8 +29,8 @@ module Rack
 
     ## A Rack application is an Ruby object (not a class) that
     ## responds to +call+.
-    def call(env=nil)
-      dup._call(env)
+    def call(env=nil)
+      dup._call(env)
     end
 
     def _call(env)
@@ -218,6 +218,10 @@ module Rack
         @input.size
       end
 
+      def rewind
+        @input.rewind
+      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 c0478ccc..b4c97573 100644
--- a/test/spec_rack_lint.rb
+++ b/test/spec_rack_lint.rb
@@ -368,4 +368,13 @@ context "Rack::Lint::InputWrapper" do
     wrapper = Rack::Lint::InputWrapper.new(IOMock.new)
     wrapper.size.should == 101
   end
+
+  specify "delegates :rewind to underlying IO object" do
+    io = StringIO.new("123")
+    wrapper = Rack::Lint::InputWrapper.new(io)
+    wrapper.read.should == "123"
+    wrapper.read.should == ""
+    wrapper.rewind
+    wrapper.read.should == "123"
+  end
 end