rack-test 0.5.7 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +6 -3
- data/History.txt +8 -0
- data/lib/rack/mock_session.rb +6 -1
- data/lib/rack/test.rb +12 -3
- data/lib/rack/test/methods.rb +1 -0
- data/rack-test.gemspec +3 -4
- data/spec/fixtures/fake_app.rb +4 -0
- data/spec/rack/test/multipart_spec.rb +1 -1
- data/spec/rack/test_spec.rb +16 -1
- metadata +7 -7
data/Gemfile.lock
CHANGED
@@ -2,7 +2,7 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
diff-lcs (1.1.2)
|
5
|
-
rack (1.2.
|
5
|
+
rack (1.2.2)
|
6
6
|
rspec (2.3.0)
|
7
7
|
rspec-core (~> 2.3.0)
|
8
8
|
rspec-expectations (~> 2.3.0)
|
@@ -11,10 +11,13 @@ GEM
|
|
11
11
|
rspec-expectations (2.3.0)
|
12
12
|
diff-lcs (~> 1.1.2)
|
13
13
|
rspec-mocks (2.3.0)
|
14
|
-
sinatra (1.
|
15
|
-
rack (
|
14
|
+
sinatra (1.2.3)
|
15
|
+
rack (~> 1.1)
|
16
|
+
tilt (< 2.0, >= 1.2.2)
|
17
|
+
tilt (1.2.2)
|
16
18
|
|
17
19
|
PLATFORMS
|
20
|
+
java
|
18
21
|
ruby
|
19
22
|
|
20
23
|
DEPENDENCIES
|
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 0.6.0 / 2011-05-03
|
2
|
+
|
3
|
+
* Bug fixes
|
4
|
+
|
5
|
+
* Add support for HTTP OPTIONS verb (Paolo "Nusco" Perrotta)
|
6
|
+
* Call #finish on MockResponses if it's available (Aaron Patterson)
|
7
|
+
* Allow HTTP_HOST to be set via #header (Geoff Buesing)
|
8
|
+
|
1
9
|
== 0.5.7 / 2011-01-01
|
2
10
|
|
3
11
|
* Bug fixes
|
data/lib/rack/mock_session.rb
CHANGED
@@ -35,7 +35,12 @@ module Rack
|
|
35
35
|
cookie_jar.merge(last_response.headers["Set-Cookie"], uri)
|
36
36
|
|
37
37
|
@after_request.each { |hook| hook.call }
|
38
|
-
|
38
|
+
|
39
|
+
if @last_response.respond_to?(:finish)
|
40
|
+
@last_response.finish
|
41
|
+
else
|
42
|
+
@last_response
|
43
|
+
end
|
39
44
|
end
|
40
45
|
|
41
46
|
# Return the last request issued in the session. Raises an error if no
|
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.
|
12
|
+
VERSION = "0.6.0"
|
13
13
|
|
14
14
|
DEFAULT_HOST = "example.org"
|
15
15
|
MULTIPART_BOUNDARY = "----------XnJLe9ZIbbGUYtzPQJ16u1"
|
@@ -84,6 +84,15 @@ module Rack
|
|
84
84
|
process_request(uri, env, &block)
|
85
85
|
end
|
86
86
|
|
87
|
+
# Issue an OPTIONS request for the given URI. See #get
|
88
|
+
#
|
89
|
+
# Example:
|
90
|
+
# options "/"
|
91
|
+
def options(uri, params = {}, env = {}, &block)
|
92
|
+
env = env_for(uri, env.merge(:method => "OPTIONS", :params => params))
|
93
|
+
process_request(uri, env, &block)
|
94
|
+
end
|
95
|
+
|
87
96
|
# Issue a HEAD request for the given URI. See #get
|
88
97
|
#
|
89
98
|
# Example:
|
@@ -161,10 +170,10 @@ module Rack
|
|
161
170
|
uri.path = "/#{uri.path}" unless uri.path[0] == ?/
|
162
171
|
uri.host ||= @default_host
|
163
172
|
|
164
|
-
env["HTTP_HOST"] ||= [uri.host, uri.port].compact.join(":")
|
165
|
-
|
166
173
|
env = default_env.merge(env)
|
167
174
|
|
175
|
+
env["HTTP_HOST"] ||= [uri.host, uri.port].compact.join(":")
|
176
|
+
|
168
177
|
env.update("HTTPS" => "on") if URI::HTTPS === uri
|
169
178
|
env["HTTP_X_REQUESTED_WITH"] = "XMLHttpRequest" if env[:xhr]
|
170
179
|
|
data/lib/rack/test/methods.rb
CHANGED
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
|
+
s.version = "0.6.0"
|
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{2011-
|
9
|
+
s.date = %q{2011-05-03}
|
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
|
@@ -50,7 +50,7 @@ request helpers feature.}
|
|
50
50
|
s.homepage = %q{http://github.com/brynary/rack-test}
|
51
51
|
s.require_paths = ["lib"]
|
52
52
|
s.rubyforge_project = %q{rack-test}
|
53
|
-
s.rubygems_version = %q{1.
|
53
|
+
s.rubygems_version = %q{1.6.1}
|
54
54
|
s.summary = %q{Simple testing API built on Rack}
|
55
55
|
s.test_files = [
|
56
56
|
"spec/fixtures/fake_app.rb",
|
@@ -65,7 +65,6 @@ request helpers feature.}
|
|
65
65
|
]
|
66
66
|
|
67
67
|
if s.respond_to? :specification_version then
|
68
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
69
68
|
s.specification_version = 3
|
70
69
|
|
71
70
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/spec/fixtures/fake_app.rb
CHANGED
@@ -58,7 +58,7 @@ describe Rack::Test::Session do
|
|
58
58
|
last_request.POST["foo"].should == "bar"
|
59
59
|
|
60
60
|
if Rack::Test.encoding_aware_strings?
|
61
|
-
last_request.POST["utf8"].should == "
|
61
|
+
last_request.POST["utf8"].should == "☃"
|
62
62
|
else
|
63
63
|
last_request.POST["utf8"].should == "\xE2\x98\x83"
|
64
64
|
end
|
data/spec/rack/test_spec.rb
CHANGED
@@ -228,6 +228,13 @@ describe Rack::Test::Session do
|
|
228
228
|
|
229
229
|
last_request.env["CONTENT_TYPE"].should == "application/json"
|
230
230
|
end
|
231
|
+
|
232
|
+
it "sets a Host to be sent with requests" do
|
233
|
+
header "Host", "www.example.ua"
|
234
|
+
request "/"
|
235
|
+
|
236
|
+
last_request.env["HTTP_HOST"].should == "www.example.ua"
|
237
|
+
end
|
231
238
|
|
232
239
|
it "persists across multiple requests" do
|
233
240
|
header "User-Agent", "Firefox"
|
@@ -325,7 +332,7 @@ describe Rack::Test::Session do
|
|
325
332
|
describe "#last_response" do
|
326
333
|
it "returns the most recent response" do
|
327
334
|
request "/"
|
328
|
-
last_response["Content-Type"].should == "text/html"
|
335
|
+
last_response["Content-Type"].should == "text/html;charset=utf-8"
|
329
336
|
end
|
330
337
|
|
331
338
|
it "raises an error if no requests have been issued" do
|
@@ -457,4 +464,12 @@ describe Rack::Test::Session do
|
|
457
464
|
"delete"
|
458
465
|
end
|
459
466
|
end
|
467
|
+
|
468
|
+
describe "#options" do
|
469
|
+
it_should_behave_like "any #verb methods"
|
470
|
+
|
471
|
+
def verb
|
472
|
+
"options"
|
473
|
+
end
|
474
|
+
end
|
460
475
|
end
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 0.6.0
|
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: 2011-
|
18
|
+
date: 2011-05-03 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements: []
|
107
107
|
|
108
108
|
rubyforge_project: rack-test
|
109
|
-
rubygems_version: 1.
|
109
|
+
rubygems_version: 1.6.1
|
110
110
|
signing_key:
|
111
111
|
specification_version: 3
|
112
112
|
summary: Simple testing API built on Rack
|