summaryrefslogtreecommitdiff
path: root/test/spec_request.rb
diff options
context:
space:
mode:
authorVictor Bilyk <victorbilyk@gmail.com>2013-12-15 15:18:20 +0600
committerVictor Bilyk <victorbilyk@gmail.com>2013-12-15 15:18:20 +0600
commit27642c271c2cc5c6be35f7decc20da57ca4a02cd (patch)
tree52b02e24b9fd8615cc12fcbe1c15251663e539c9 /test/spec_request.rb
parent5a5aee3612f3d1c56424ad387ada56174fd94828 (diff)
downloadrack-27642c271c2cc5c6be35f7decc20da57ca4a02cd.tar.gz
test case for raising proper exception every time broken parameters accessed
Diffstat (limited to 'test/spec_request.rb')
-rw-r--r--test/spec_request.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/spec_request.rb b/test/spec_request.rb
index a3f42379..8d54a530 100644
--- a/test/spec_request.rb
+++ b/test/spec_request.rb
@@ -1098,6 +1098,13 @@ EOF
req2.params.should.equal "foo" => "bar"
end
+ should "raise TypeError every time if request parameters are broken" do
+ broken_query = Rack::MockRequest.env_for("/?foo[]=0&foo[bar]=1")
+ req = Rack::Request.new(broken_query)
+ lambda{req.GET}.should.raise(TypeError)
+ lambda{req.params}.should.raise(TypeError)
+ end
+
(0x20...0x7E).collect { |a|
b = a.chr
c = CGI.escape(b)