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.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/spec_mock.rb b/test/spec_mock.rb
index 3ebd7776..1bb22974 100644
--- a/test/spec_mock.rb
+++ b/test/spec_mock.rb
@@ -211,6 +211,26 @@ describe Rack::MockRequest do
     Rack::MockRequest.new(capp).get('/', :lint => true)
     called.should.equal true
   end
+
+  unless "<3".respond_to? :encoding
+    should "defaults encoding to ASCII 8BIT" do
+      req = Rack::MockRequest.env_for("/foo")
+
+      keys = [
+        Rack::REQUEST_METHOD,
+        "SERVER_NAME",
+        "SERVER_PORT",
+        Rack::QUERY_STRING,
+        Rack::PATH_INFO,
+        "rack.url_scheme",
+        "HTTPS"
+      ]
+
+      keys.each do |k|
+        req[k].encoding.should.equal Encoding::ASCII_8BIT
+      end
+    end
+  end
 end
 
 describe Rack::MockResponse do