rack-test 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/lib/rack/test.rb +1 -1
- data/lib/rack/test/cookie_jar.rb +2 -1
- data/rack-test.gemspec +2 -2
- data/spec/fixtures/fake_app.rb +8 -0
- data/spec/rack/test/cookie_spec.rb +9 -0
- metadata +2 -2
data/History.txt
CHANGED
data/lib/rack/test.rb
CHANGED
data/lib/rack/test/cookie_jar.rb
CHANGED
@@ -71,8 +71,9 @@ module Rack
|
|
71
71
|
uri.host = @default_host
|
72
72
|
end
|
73
73
|
|
74
|
+
real_domain = domain =~ /^\./ ? domain[1..-1] : domain
|
74
75
|
(!secure? || (secure? && uri.scheme == "https")) &&
|
75
|
-
uri.host =~ Regexp.new("#{Regexp.escape(
|
76
|
+
uri.host =~ Regexp.new("#{Regexp.escape(real_domain)}$", Regexp::IGNORECASE) &&
|
76
77
|
uri.path =~ Regexp.new("^#{Regexp.escape(path)}")
|
77
78
|
end
|
78
79
|
|
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.3"
|
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{2009-11-
|
9
|
+
s.date = %q{2009-11-27}
|
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
|
data/spec/fixtures/fake_app.rb
CHANGED
@@ -81,6 +81,14 @@ module Rack
|
|
81
81
|
new_value
|
82
82
|
end
|
83
83
|
|
84
|
+
get "/cookies/subdomain" do
|
85
|
+
old_value = request.cookies["count"].to_i || 0
|
86
|
+
new_value = (old_value + 1).to_s
|
87
|
+
|
88
|
+
response.set_cookie("count", :value => new_value, :domain => ".example.org")
|
89
|
+
new_value
|
90
|
+
end
|
91
|
+
|
84
92
|
get "/cookies/set-uppercase" do
|
85
93
|
raise if params["value"].nil?
|
86
94
|
|
@@ -133,6 +133,15 @@ describe Rack::Test::Session do
|
|
133
133
|
last_request.cookies.should == { "value" => "example" }
|
134
134
|
end
|
135
135
|
|
136
|
+
it "keeps one cookie jar for domain and its subdomains" do
|
137
|
+
get "http://example.org/cookies/subdomain"
|
138
|
+
get "http://example.org/cookies/subdomain"
|
139
|
+
last_request.cookies.should == { "count" => "1" }
|
140
|
+
|
141
|
+
get "http://foo.example.org/cookies/subdomain"
|
142
|
+
last_request.cookies.should == { "count" => "2" }
|
143
|
+
end
|
144
|
+
|
136
145
|
it "allows cookies to be cleared" do
|
137
146
|
get "/cookies/set", "value" => "1"
|
138
147
|
clear_cookies
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Helmkamp
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-27 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|