summary refs log tree commit
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/spec_mock.rb6
-rw-r--r--test/spec_multipart.rb6
2 files changed, 9 insertions, 3 deletions
diff --git a/test/spec_mock.rb b/test/spec_mock.rb
index a4d4e5a5..6e5555d1 100644
--- a/test/spec_mock.rb
+++ b/test/spec_mock.rb
@@ -84,6 +84,12 @@ 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"
   end
 
   it "allow posting" do
diff --git a/test/spec_multipart.rb b/test/spec_multipart.rb
index 2f957d92..6f1f0d9a 100644
--- a/test/spec_multipart.rb
+++ b/test/spec_multipart.rb
@@ -107,8 +107,8 @@ describe Rack::Multipart do
     def rd.rewind; end
     wr.sync = true
 
-    # mock out length to make this pipe look like a Tempfile
-    def rd.length
+    # mock out size to make this pipe look like a Tempfile
+    def rd.size
       1024 * 1024 * 8
     end
 
@@ -136,7 +136,7 @@ describe Rack::Multipart do
 
     fixture = {
       "CONTENT_TYPE" => "multipart/form-data; boundary=AaB03x",
-      "CONTENT_LENGTH" => rd.length.to_s,
+      "CONTENT_LENGTH" => rd.size.to_s,
       :input => rd,
     }