sbsm 1.5.1 → 1.5.2

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: d54dfb08f0b27dc20f788152dc58721b5a71d9f7
4
- data.tar.gz: 78d415485525ac67216b43dc677a79e1bccd4bfb
3
+ metadata.gz: 97b5380c3233416078670d095b29e76843a7476b
4
+ data.tar.gz: 2f4f64aaf4eab500ff12dc698d1fc6249b3990af
5
5
  SHA512:
6
- metadata.gz: e05045a10f97fc9f884743d46c5cbf791fc9a6d826d6e2c7d6227a7b3ef9bac47f8aa211e94e0b7e8e765025195ec29e1c42a92502eb18b96d0bca2e6fb65d51
7
- data.tar.gz: f7852b80aaa5d5199aafdda19d733048704375e5c26e9bf4e4d42c739747ce4949fd3c7dd3fa525eb855ff0aab372ef6a550a1437fe339c8214b737b5b090227
6
+ metadata.gz: '08d78ff9c24108e41163516ed78e2a90f1697b311f00c409aec9480d7f694be12bcf3b95b73589bd84eccf982201ef5b0801fd2d7fb89656dde83d4d3ec559fc'
7
+ data.tar.gz: 1897c958748d506cf989c0057a3f86f386c8172d04855e507f8126ec38731284d8c37ad4a7b0466fb7c779a7e3e3f6c72a4446925ec0eb1d03e70e102ac8f5f2
data/History.txt CHANGED
@@ -1,6 +1,10 @@
1
+ === 1.5.2 / 04.07.2017
2
+
3
+ * Fix handling true/false values in cookie
4
+
1
5
  === 1.5.1 / 04.07.2017
2
6
 
3
- * Return 302 if http_headers contain 'Location
7
+ * Return 302 if http_headers contain 'Location'
4
8
 
5
9
  === 1.5.0 / 04.07.2017
6
10
 
data/lib/sbsm/session.rb CHANGED
@@ -443,7 +443,19 @@ module SBSM
443
443
  end
444
444
  end
445
445
  def cookie_pairs
446
- cookie_input.collect { |key, value| "#{key}=#{value ?CGI.escape(value) : ''}" }.join(';')
446
+ cookie_input.collect do |key, value|
447
+ if value
448
+ if value.is_a?(String)
449
+ "#{key}=#{CGI.escape(value)}"
450
+ else
451
+ "#{key}=#{value}"
452
+ end
453
+ else
454
+ "#{key}="
455
+ end
456
+ end.join(';')
457
+ rescue => error
458
+ binding.pry
447
459
  end
448
460
  def http_headers
449
461
  @state.http_headers
data/lib/sbsm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SBSM
2
- VERSION = '1.5.1'
2
+ VERSION = '1.5.2'
3
3
  end
@@ -171,16 +171,21 @@ class TestSession < Minitest::Test
171
171
  end
172
172
  def test_cookie_pairs
173
173
  @session.cookie_input = { 'name_last' => 'Müller', 'name_first' => 'Cécile',
174
- 'nil_value' => nil, 'empty_string' => ''}
175
- assert_equal('name_last=M%C3%BCller;name_first=C%C3%A9cile;nil_value=;empty_string=', @session.cookie_pairs)
174
+ 'nil_value' => nil, 'empty_string' => '',
175
+ 'boolean_true' => true,
176
+ 'boolean_false' => false,
177
+ }
178
+ assert_equal('name_last=M%C3%BCller;name_first=C%C3%A9cile;nil_value=;empty_string=;boolean_true=true;boolean_false=', @session.cookie_pairs)
176
179
  @request.cookies[@session.persistent_cookie_name] = @session.cookie_pairs
177
180
  @session.cookie_input = {}
178
181
  assert_equal({}, @session.cookie_input)
179
182
  @session.process_rack(rack_request: @request)
180
- assert_equal([:name_last, :name_first, :nil_value, :empty_string], @session.cookie_input.keys)
183
+ assert_equal([:name_last, :name_first, :nil_value, :empty_string, :boolean_true, :boolean_false], @session.cookie_input.keys)
181
184
  assert_equal('Müller', @session.cookie_input[:name_last])
182
185
  assert_equal('Cécile', @session.cookie_input[:name_first])
186
+ assert_equal('true', @session.cookie_input[:boolean_true])
183
187
  assert_equal('', @session.cookie_input[:nil_value])
184
188
  assert_equal('', @session.cookie_input[:empty_string])
189
+ assert_equal('', @session.cookie_input[:boolean_false])
185
190
  end
186
191
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz