riot-gear 0.0.17 → 0.0.18
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.
- checksums.yaml +4 -4
- data/lib/riot/gear/middleware/riotparty.rb +2 -1
- data/lib/riot/gear/version.rb +1 -1
- data/test/helpers/cookie_values_test.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8043cbc4046be88adfd8a08d1a18ba1b37a81ab7
|
|
4
|
+
data.tar.gz: 6661e1e2390b806346b2142724c97cc9e17417d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86cafab9638780bc58226415105472a0c8776b61a184ed1acb5bcb4ef3fa85699da4b71ebba96e9305b8296547424535667a366b1a99cffb2a3cb6687f428292
|
|
7
|
+
data.tar.gz: 598ab2a17f3ab9a9f280efe80657693ee7d99ed8af0b7956b1931e48c3f406c8d06b01761ec884ecc0fa52c7c6d392868ab2abc2ca0c539a15f2fb277b1f1aab
|
|
@@ -161,7 +161,8 @@ private
|
|
|
161
161
|
# @param [Riot::Context] context the context to add the helper to
|
|
162
162
|
def helper_cookie_value(context)
|
|
163
163
|
context.helper(:cookie_values) do
|
|
164
|
-
response.header["set-cookie"]
|
|
164
|
+
set_cookie = response.header["set-cookie"] || ""
|
|
165
|
+
set_cookie.split("\n").inject({}) do |jar, cookie_str|
|
|
165
166
|
(name, value), *bits = cookie_str.split(/; ?/).map { |bit| bit.split('=') }
|
|
166
167
|
jar.merge!(name => bits.inject({"value" => value}) { |h, (k,v)| h.merge!(k => v) })
|
|
167
168
|
end
|
data/lib/riot/gear/version.rb
CHANGED
|
@@ -27,3 +27,19 @@ context "The cookie_values helper" do
|
|
|
27
27
|
cookie_values["goo"]
|
|
28
28
|
end.equals({"value" => "jam", "path" => "/blue", "expires" => "sometime-soon"})
|
|
29
29
|
end # The cookie_values helper
|
|
30
|
+
|
|
31
|
+
context "The cookie_values helper when no Set-Cookie" do
|
|
32
|
+
hookup do
|
|
33
|
+
stub_request(:get, 'http://foo/tossed-cookies').
|
|
34
|
+
to_return({
|
|
35
|
+
:status => 200,
|
|
36
|
+
:headers => {},
|
|
37
|
+
:body => ""
|
|
38
|
+
})
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
get "http://foo/tossed-cookies"
|
|
42
|
+
|
|
43
|
+
asserts("non-existent foo cookie") { cookie_values["foo"] }.nil
|
|
44
|
+
asserts("non-existent bar cookie") { cookie_values["bar"] }.nil
|
|
45
|
+
end # The cookie_values helper
|