parent
d3dbfc75c7
commit
07b9d2a26d
@ -1,3 +1,4 @@
|
||||
rack-1.1.0.gem
|
||||
/rack-1.3.0.gem
|
||||
/rack-1.4.0.gem
|
||||
/rack-1.4.1.gem
|
||||
|
@ -1,43 +0,0 @@
|
||||
From 17a3e1ea7be50094d09b6f5fbb4770b5468e8421 Mon Sep 17 00:00:00 2001
|
||||
From: HannesG <hag@informatik.uni-kiel.de>
|
||||
Date: Thu, 29 Dec 2011 19:23:32 +0100
|
||||
Subject: [PATCH] Test an object which repsonds to each instead of a set.
|
||||
|
||||
---
|
||||
test/spec_response.rb | 9 ++++++---
|
||||
1 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/test/spec_response.rb b/test/spec_response.rb
|
||||
index 07dd012..589063e 100644
|
||||
--- a/test/spec_response.rb
|
||||
+++ b/test/spec_response.rb
|
||||
@@ -1,4 +1,3 @@
|
||||
-require 'set'
|
||||
require 'rack/response'
|
||||
require 'stringio'
|
||||
|
||||
@@ -125,7 +124,6 @@ describe Rack::Response do
|
||||
response = Rack::Response.new
|
||||
response.redirect "/foo"
|
||||
status, header, body = response.finish
|
||||
-
|
||||
status.should.equal 302
|
||||
header["Location"].should.equal "/foo"
|
||||
|
||||
@@ -147,7 +145,12 @@ describe Rack::Response do
|
||||
str = ""; body.each { |part| str << part }
|
||||
str.should.equal "foobar"
|
||||
|
||||
- r = Rack::Response.new(["foo", "bar"].to_set)
|
||||
+ object_with_each = Object.new
|
||||
+ def object_with_each.each
|
||||
+ yield "foo"
|
||||
+ yield "bar"
|
||||
+ end
|
||||
+ r = Rack::Response.new(object_with_each)
|
||||
r.write "foo"
|
||||
status, header, body = r.finish
|
||||
str = ""; body.each { |part| str << part }
|
||||
--
|
||||
1.7.7.5
|
||||
|
@ -1,62 +0,0 @@
|
||||
From c711cd421f3eacfde9965b4b38f41acc5754b5d0 Mon Sep 17 00:00:00 2001
|
||||
From: HannesG <hag@informatik.uni-kiel.de>
|
||||
Date: Thu, 29 Dec 2011 19:24:03 +0100
|
||||
Subject: [PATCH] Utils tests now accept different query orders.
|
||||
|
||||
---
|
||||
test/spec_utils.rb | 21 +++++++++++++++------
|
||||
1 files changed, 15 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/test/spec_utils.rb b/test/spec_utils.rb
|
||||
index a787763..069e229 100644
|
||||
--- a/test/spec_utils.rb
|
||||
+++ b/test/spec_utils.rb
|
||||
@@ -3,6 +3,15 @@ require 'rack/utils'
|
||||
require 'rack/mock'
|
||||
|
||||
describe Rack::Utils do
|
||||
+
|
||||
+ # A helper method which checks
|
||||
+ # if certain query parameters
|
||||
+ # are equal.
|
||||
+ def equal_query_to(query)
|
||||
+ parts = query.split('&')
|
||||
+ lambda{|other| (parts & other.split('&')) == parts }
|
||||
+ end
|
||||
+
|
||||
def kcodeu
|
||||
one8 = RUBY_VERSION.to_f < 1.9
|
||||
default_kcode, $KCODE = $KCODE, 'U' if one8
|
||||
@@ -187,13 +196,13 @@ describe Rack::Utils do
|
||||
end
|
||||
|
||||
should "build query strings correctly" do
|
||||
- Rack::Utils.build_query("foo" => "bar").should.equal "foo=bar"
|
||||
+ Rack::Utils.build_query("foo" => "bar").should.be equal_query_to("foo=bar")
|
||||
Rack::Utils.build_query("foo" => ["bar", "quux"]).
|
||||
- should.equal "foo=bar&foo=quux"
|
||||
+ should.be equal_query_to("foo=bar&foo=quux")
|
||||
Rack::Utils.build_query("foo" => "1", "bar" => "2").
|
||||
- should.equal "foo=1&bar=2"
|
||||
+ should.be equal_query_to("foo=1&bar=2")
|
||||
Rack::Utils.build_query("my weird field" => "q1!2\"'w$5&7/z8)?").
|
||||
- should.equal "my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F"
|
||||
+ should.be equal_query_to("my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F")
|
||||
end
|
||||
|
||||
should "build nested query strings correctly" do
|
||||
@@ -202,9 +211,9 @@ describe Rack::Utils do
|
||||
Rack::Utils.build_nested_query("foo" => "bar").should.equal "foo=bar"
|
||||
|
||||
Rack::Utils.build_nested_query("foo" => "1", "bar" => "2").
|
||||
- should.equal "foo=1&bar=2"
|
||||
+ should.be equal_query_to("foo=1&bar=2")
|
||||
Rack::Utils.build_nested_query("my weird field" => "q1!2\"'w$5&7/z8)?").
|
||||
- should.equal "my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F"
|
||||
+ should.be equal_query_to("my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F")
|
||||
|
||||
Rack::Utils.build_nested_query("foo" => [nil]).
|
||||
should.equal "foo[]"
|
||||
--
|
||||
1.7.7.5
|
||||
|
Loading…
Reference in new issue