summary refs log tree commit
diff options
context:
space:
mode:
authorRich Meyers <richmeyers@gmx.com>2010-08-12 02:30:55 +0800
committerJoshua Peek <josh@joshpeek.com>2010-12-10 04:19:13 +0800
commit672396f0fdaa639981daaf7e6ff309c76f71b352 (patch)
tree91ceb8a842662d1d8e86b390d55cbcfa4c2ffc2a
parent8810d690095fd87e6bf8d7addfbdf1b50853a3eb (diff)
downloadrack-672396f0fdaa639981daaf7e6ff309c76f71b352.tar.gz
Treat an empty content type as nil content type (issue #40) -- tests
-rw-r--r--test/spec_request.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/spec_request.rb b/test/spec_request.rb
index e3989bf8..f240be40 100644
--- a/test/spec_request.rb
+++ b/test/spec_request.rb
@@ -236,6 +236,24 @@ describe Rack::Request do
     req.user_agent.should.equal nil
   end
 
+  should "treat missing content type as nil" do
+    req = Rack::Request.new \
+      Rack::MockRequest.env_for("/")
+    req.content_type.should.equal nil
+  end
+
+  should "treat empty content type as nil" do
+    req = Rack::Request.new \
+      Rack::MockRequest.env_for("/", "CONTENT_TYPE" => "")
+    req.content_type.should.equal nil
+  end
+
+  should "return nil media type for empty content type" do
+    req = Rack::Request.new \
+      Rack::MockRequest.env_for("/", "CONTENT_TYPE" => "")
+    req.media_type.should.equal nil
+  end
+
   should "cache, but invalidates the cache" do
     req = Rack::Request.new \
       Rack::MockRequest.env_for("/?foo=quux",