aboutsummaryrefslogtreecommitdiff
path: root/spec/unit/uri/parse_query_string_spec.rb
diff options
context:
space:
mode:
authorStormwind <stormwind@stormwinds-page.de>2012-12-22 19:08:02 +0100
committerStormwind <stormwind@stormwinds-page.de>2012-12-22 19:08:02 +0100
commit835234a52c487002a516792dbdea3a44d110ba3d (patch)
tree6fce9eb0b4a96a22934dbe8c897dcf4859b542b5 /spec/unit/uri/parse_query_string_spec.rb
parent0e12faff226e73ea932150a912e89b3363fed76e (diff)
Improve query valid regex
Now a query string cannot look like 'foo=bar=foo' anymore.
Diffstat (limited to 'spec/unit/uri/parse_query_string_spec.rb')
-rw-r--r--spec/unit/uri/parse_query_string_spec.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/unit/uri/parse_query_string_spec.rb b/spec/unit/uri/parse_query_string_spec.rb
index a165cf3..3a36cc0 100644
--- a/spec/unit/uri/parse_query_string_spec.rb
+++ b/spec/unit/uri/parse_query_string_spec.rb
@@ -114,6 +114,32 @@ describe URI, '#parse_query_string' do
result.should eq([])
end
- # what happend on more than one = without an & or ; in between?
+ it 'throws an error, if more than one = without an & or ; in between' do
+ expect {
+ result = URI::parse_query_string("foo=bar=foo&bar=foo=bar")
+ }.to raise_error(
+ ArgumentError,
+ "invalid data of application/x-www-form-urlencoded "+
+ "(foo=bar=foo&bar=foo=bar)"
+ )
+ end
+
+ it 'throws an error, if more than one & without an = in between' do
+ expect {
+ result = URI::parse_query_string("foo&bar=foo&bar")
+ }.to raise_error(
+ ArgumentError,
+ "invalid data of application/x-www-form-urlencoded (foo&bar=foo&bar)"
+ )
+ end
+
+ it 'throws an error, if more than one ; without an = in between' do
+ expect {
+ result = URI::parse_query_string("foo;bar=foo;bar")
+ }.to raise_error(
+ ArgumentError,
+ "invalid data of application/x-www-form-urlencoded (foo;bar=foo;bar)"
+ )
+ end
end