riot-gear 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02105d972253f19b54af37e35149d8b468ba65ab
4
- data.tar.gz: b762bed40d2664b222219bf0ad402cb8f305afb5
3
+ metadata.gz: 8043cbc4046be88adfd8a08d1a18ba1b37a81ab7
4
+ data.tar.gz: 6661e1e2390b806346b2142724c97cc9e17417d0
5
5
  SHA512:
6
- metadata.gz: 503a045e316f61ba0e42ce782ef4685f7de7aeffec505b699d15fe913e39e78e4edd2c5e5af3443f7405c334283fc6b839a2501ee938b474c5c3d5e7ef378b4f
7
- data.tar.gz: 670908263b29103e87e562c06b0b3ce39c74e1899def92e70f25204db9ea7e90dd80fcf0a3fbcd4ab695f427632039ba620886161f01f09258b4eb9b8351e5fd
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"].split("\n").inject({}) do |jar, cookie_str|
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
@@ -1,5 +1,5 @@
1
1
  module Riot
2
2
  module Gear
3
- VERSION = "0.0.17"
3
+ VERSION = "0.0.18"
4
4
  end
5
5
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riot-gear
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin 'Gus' Knowlden