summary refs log tree commit
path: root/test/spec_mock.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/spec_mock.rb')
-rw-r--r--test/spec_mock.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/spec_mock.rb b/test/spec_mock.rb
index e383f203..c7992321 100644
--- a/test/spec_mock.rb
+++ b/test/spec_mock.rb
@@ -84,6 +84,15 @@ describe Rack::MockRequest do
   it "set content length" do
     env = Rack::MockRequest.env_for("/", :input => "foo")
     env["CONTENT_LENGTH"].must_equal "3"
+
+    env = Rack::MockRequest.env_for("/", :input => StringIO.new("foo"))
+    env["CONTENT_LENGTH"].must_equal "3"
+
+    env = Rack::MockRequest.env_for("/", :input => Tempfile.new("name").tap { |t| t << "foo" })
+    env["CONTENT_LENGTH"].must_equal "3"
+
+    env = Rack::MockRequest.env_for("/", :input => IO.pipe.first)
+    env["CONTENT_LENGTH"].must_be_nil
   end
 
   it "allow posting" do