rack-test 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +9 -1
- data/lib/rack/test.rb +7 -3
- data/lib/rack/test/utils.rb +1 -1
- data/rack-test.gemspec +2 -4
- data/spec/rack/test/multipart_spec.rb +1 -1
- data/spec/rack/test_spec.rb +10 -0
- metadata +4 -6
- data/spec/support/core_ext/string.rb +0 -12
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== Git
|
2
|
+
|
3
|
+
== 0.5.6 / 2010-09-25
|
4
|
+
|
5
|
+
* Use parse_nested_query for parsing URI like Rack does (Eugene Bolshakov)
|
6
|
+
* Don't depend on ActiveSupport extension to String (Bryan Helmkamp)
|
7
|
+
* Do not overwrite HTTP_HOST if it is set (Krekoten' Marjan)
|
8
|
+
|
1
9
|
== 0.5.5 / 2010-09-22
|
2
10
|
|
3
11
|
* Bug fixes
|
@@ -5,7 +13,7 @@
|
|
5
13
|
* Fix encoding of file uploads on Ruby 1.9 (Alan Kennedy)
|
6
14
|
* Set env["HTTP_HOST"] when making requests (Istvan Hoka)
|
7
15
|
|
8
|
-
== 0.5.4 /
|
16
|
+
== 0.5.4 / 2010-05-26
|
9
17
|
|
10
18
|
* Bug fixes
|
11
19
|
|
data/lib/rack/test.rb
CHANGED
@@ -9,7 +9,7 @@ require "rack/test/uploaded_file"
|
|
9
9
|
|
10
10
|
module Rack
|
11
11
|
module Test
|
12
|
-
VERSION = "0.5.
|
12
|
+
VERSION = "0.5.6"
|
13
13
|
|
14
14
|
DEFAULT_HOST = "example.org"
|
15
15
|
MULTIPART_BOUNDARY = "----------XnJLe9ZIbbGUYtzPQJ16u1"
|
@@ -161,7 +161,7 @@ module Rack
|
|
161
161
|
uri.path = "/#{uri.path}" unless uri.path[0] == ?/
|
162
162
|
uri.host ||= @default_host
|
163
163
|
|
164
|
-
env["HTTP_HOST"]
|
164
|
+
env["HTTP_HOST"] ||= [uri.host, uri.port].compact.join(":")
|
165
165
|
|
166
166
|
env = default_env.merge(env)
|
167
167
|
|
@@ -175,7 +175,7 @@ module Rack
|
|
175
175
|
if env["REQUEST_METHOD"] == "GET"
|
176
176
|
params = env[:params] || {}
|
177
177
|
params = parse_nested_query(params) if params.is_a?(String)
|
178
|
-
params.update(
|
178
|
+
params.update(parse_nested_query(uri.query))
|
179
179
|
uri.query = build_nested_query(params)
|
180
180
|
elsif !env.has_key?(:input)
|
181
181
|
env["CONTENT_TYPE"] ||= "application/x-www-form-urlencoded"
|
@@ -275,5 +275,9 @@ module Rack
|
|
275
275
|
|
276
276
|
end
|
277
277
|
|
278
|
+
def self.encoding_aware_strings?
|
279
|
+
defined?(Encoding) && "".respond_to?(:encode)
|
280
|
+
end
|
281
|
+
|
278
282
|
end
|
279
283
|
end
|
data/lib/rack/test/utils.rb
CHANGED
@@ -96,7 +96,7 @@ module Rack
|
|
96
96
|
|
97
97
|
else
|
98
98
|
primitive_part = build_primitive_part(name, value)
|
99
|
-
|
99
|
+
Rack::Test.encoding_aware_strings? ? primitive_part.force_encoding('BINARY') : primitive_part
|
100
100
|
end
|
101
101
|
|
102
102
|
}.join + "--#{MULTIPART_BOUNDARY}--\r"
|
data/rack-test.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rack-test}
|
5
|
-
s.version = "0.5.
|
5
|
+
s.version = "0.5.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Bryan Helmkamp"]
|
9
|
-
s.date = %q{2010-09-
|
9
|
+
s.date = %q{2010-09-25}
|
10
10
|
s.description = %q{Rack::Test is a small, simple testing API for Rack apps. It can be used on its
|
11
11
|
own or as a reusable starting point for Web frameworks and testing libraries
|
12
12
|
to build on. Most of its initial functionality is an extraction of Merb 1.0's
|
@@ -44,7 +44,6 @@ request helpers feature.}
|
|
44
44
|
"spec/rack/test/utils_spec.rb",
|
45
45
|
"spec/rack/test_spec.rb",
|
46
46
|
"spec/spec_helper.rb",
|
47
|
-
"spec/support/core_ext/string.rb",
|
48
47
|
"spec/support/matchers/body.rb",
|
49
48
|
"spec/support/matchers/challenge.rb"
|
50
49
|
]
|
@@ -61,7 +60,6 @@ request helpers feature.}
|
|
61
60
|
"spec/rack/test/utils_spec.rb",
|
62
61
|
"spec/rack/test_spec.rb",
|
63
62
|
"spec/spec_helper.rb",
|
64
|
-
"spec/support/core_ext/string.rb",
|
65
63
|
"spec/support/matchers/body.rb",
|
66
64
|
"spec/support/matchers/challenge.rb"
|
67
65
|
]
|
@@ -57,7 +57,7 @@ describe Rack::Test::Session do
|
|
57
57
|
post "/", "photo" => uploaded_file, "foo" => "bar", "utf8" => "☃"
|
58
58
|
last_request.POST["foo"].should == "bar"
|
59
59
|
|
60
|
-
if
|
60
|
+
if Rack::Test.encoding_aware_strings?
|
61
61
|
last_request.POST["utf8"].should == "\xE2\x98\x83".force_encoding("BINARY")
|
62
62
|
else
|
63
63
|
last_request.POST["utf8"].should == "\xE2\x98\x83"
|
data/spec/rack/test_spec.rb
CHANGED
@@ -29,6 +29,11 @@ describe Rack::Test::Session do
|
|
29
29
|
last_request.env["X-Foo"].should == "bar"
|
30
30
|
end
|
31
31
|
|
32
|
+
it "allows HTTP_HOST to be set" do
|
33
|
+
request "/", "HTTP_HOST" => "www.example.ua"
|
34
|
+
last_request.env['HTTP_HOST'].should == "www.example.ua"
|
35
|
+
end
|
36
|
+
|
32
37
|
it "defaults to GET" do
|
33
38
|
request "/"
|
34
39
|
last_request.env["REQUEST_METHOD"].should == "GET"
|
@@ -91,6 +96,11 @@ describe Rack::Test::Session do
|
|
91
96
|
last_request.GET.should == { "baz" => "2", "foo" => { "bar" => "1" }}
|
92
97
|
end
|
93
98
|
|
99
|
+
it "parses query strings with repeated variable names correctly" do
|
100
|
+
request "/foo?bar=2&bar=3"
|
101
|
+
last_request.GET.should == { "bar" => "3" }
|
102
|
+
end
|
103
|
+
|
94
104
|
it "accepts raw input in params for GET requests" do
|
95
105
|
request "/foo?baz=2", :params => "foo[bar]=1"
|
96
106
|
last_request.GET.should == { "baz" => "2", "foo" => { "bar" => "1" }}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 6
|
10
|
+
version: 0.5.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bryan Helmkamp
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-25 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -74,7 +74,6 @@ files:
|
|
74
74
|
- spec/rack/test/utils_spec.rb
|
75
75
|
- spec/rack/test_spec.rb
|
76
76
|
- spec/spec_helper.rb
|
77
|
-
- spec/support/core_ext/string.rb
|
78
77
|
- spec/support/matchers/body.rb
|
79
78
|
- spec/support/matchers/challenge.rb
|
80
79
|
has_rdoc: true
|
@@ -119,6 +118,5 @@ test_files:
|
|
119
118
|
- spec/rack/test/utils_spec.rb
|
120
119
|
- spec/rack/test_spec.rb
|
121
120
|
- spec/spec_helper.rb
|
122
|
-
- spec/support/core_ext/string.rb
|
123
121
|
- spec/support/matchers/body.rb
|
124
122
|
- spec/support/matchers/challenge.rb
|