bson 4.10.1 → 4.11.0

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
  SHA256:
3
- metadata.gz: e39811e4c57495904b3efdb835093609b89e3eea90bc5c493c56bc3adf803a29
4
- data.tar.gz: ac5ca45bcfe81e133931420591d8c866b674912138cbcc5de36edfb94d0ee2ce
3
+ metadata.gz: 06e075081379ce36a9733b97e65fe9ddedf5c02abbff44f4f80900996f978382
4
+ data.tar.gz: 291dbafc79f5a81287304b17976baefa9c218ae4a9728535ac045f99f61e9a41
5
5
  SHA512:
6
- metadata.gz: 6a9d6eb3a581073ba8de7bf5d718d2368426841ea6681d82bb771239759aa62038c281c596caf853e898d00af7549b96e1b5f48e3b04a04ff652e93f94f8c5f3
7
- data.tar.gz: f7f4b93b14c632ce2b70211bbb879b24a0e65cc2f4bdf430b75d88c9f6b994f931ce8fdd1021dbd987b52ce634972a0155dc0468caca22bb4264a60a7c2b895d
6
+ metadata.gz: 50915432ff0dd69ec3a2be50f718a5dfcdc5bc000d619652be55e3543493b2d5f91074018b96e17dcd4f20efcd56bde31204c4badc24a8f46a99c1effb2f1602
7
+ data.tar.gz: 897db48b82f0dd8af1a1e3597cb8bcbf3d9d0679211e19407ffcf872db1615594dfce9b18baedfda3e7d299c9519cc63c047e026866f8b767e05dff10b3e7ae9
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- e��~��B�\���z�̡����?�2K��@����5'��1r5o�Z��EL2k6��C�I*�!.�#/C��~ה�����>�,�R#��Y'°A��[Fu'���N�ݸ���6��-�Ҩd�F�T����xŠ�]�l�@f��f�µ�k���ݑ�Op�,��ЗQ��Ś��f5�;��yNS�h�=9�Ö}��<e�:F�� �8�=#~-Sƙ��e�X��Gr��˿s�+^=����BU���ܤr
1
+ gC���S��~�9}6���ӟ�a`K�����ھ'b�� �h��q���JO���Ĭ��j������Ш��M�����)e�8e�'#���t����$,E&:H� �
2
+ U��܀� �b��vP#�J�d����j��Wn� ��zqۣ�)%]뀱a�+'@�\�w̋��3�,�t���˷O� p1ُ��)�A��T����L��K�z,�Ŵ�SXZ���50N2|!��2�2��V8�0���ވ���
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module BSON
16
- VERSION = "4.10.1".freeze
16
+ VERSION = "4.11.0".freeze
17
17
  end
@@ -30,8 +30,8 @@ describe BSON::ByteBuffer do
30
30
  let(:buffer) do
31
31
  described_class.new
32
32
  end
33
-
34
- context '#put_int32' do
33
+
34
+ context '#put_int32' do
35
35
  before do
36
36
  buffer.put_int32(5)
37
37
  end
@@ -107,4 +107,45 @@ describe BSON::ByteBuffer do
107
107
  expect(buffer.write_position).to eq(1)
108
108
  end
109
109
  end
110
+
111
+ describe 'write followed by read' do
112
+ let(:buffer) do
113
+ described_class.new
114
+ end
115
+
116
+ context 'one cycle' do
117
+ it 'returns the written data' do
118
+ buffer.put_cstring('hello')
119
+ buffer.get_cstring.should == 'hello'
120
+ end
121
+ end
122
+
123
+ context 'two cycles' do
124
+ it 'returns the written data' do
125
+ buffer.put_cstring('hello')
126
+ buffer.get_cstring.should == 'hello'
127
+
128
+ buffer.put_cstring('world')
129
+ buffer.get_cstring.should == 'world'
130
+ end
131
+ end
132
+
133
+ context 'mixed cycles' do
134
+ it 'returns the written data' do
135
+ if BSON::Environment.jruby?
136
+ pending 'RUBY-2334'
137
+ end
138
+
139
+ buffer.put_int32(1)
140
+ buffer.put_int32(2)
141
+
142
+ buffer.get_int32.should == 1
143
+
144
+ buffer.put_int32(3)
145
+
146
+ buffer.get_int32.should == 2
147
+ buffer.get_int32.should == 3
148
+ end
149
+ end
150
+ end
110
151
  end
@@ -244,6 +244,16 @@ describe Hash do
244
244
  /(Hash value for key 'foo'|Value) does not define its BSON serialized type:.*HashSpecUnserializableClass/)
245
245
  end
246
246
  end
247
+
248
+ context 'when reading from a byte buffer that was previously written to' do
249
+ let(:buffer) do
250
+ {foo: 42}.to_bson
251
+ end
252
+
253
+ it 'returns the original hash' do
254
+ expect(Hash.from_bson(buffer)).to eq('foo' => 42)
255
+ end
256
+ end
247
257
  end
248
258
 
249
259
  describe '#to_bson' do
@@ -310,4 +320,50 @@ describe Hash do
310
320
  end
311
321
  end
312
322
  end
323
+
324
+ describe '#from_bson' do
325
+ context 'when bson document has duplicate keys' do
326
+ let(:buf) do
327
+ buf = BSON::ByteBuffer.new
328
+ buf.put_int32(37)
329
+ buf.put_byte("\x02")
330
+ buf.put_cstring('foo')
331
+ buf.put_string('bar')
332
+ buf.put_byte("\x02")
333
+ buf.put_cstring('foo')
334
+ buf.put_string('overwrite')
335
+ buf.put_byte("\x00")
336
+
337
+ BSON::ByteBuffer.new(buf.to_s)
338
+ end
339
+
340
+ let(:doc) { Hash.from_bson(buf) }
341
+
342
+ it 'overwrites first value with second value' do
343
+ doc.should == {'foo' => 'overwrite'}
344
+ end
345
+ end
346
+
347
+ context 'when bson document has string and symbol keys of the same name' do
348
+ let(:buf) do
349
+ buf = BSON::ByteBuffer.new
350
+ buf.put_int32(31)
351
+ buf.put_byte("\x02")
352
+ buf.put_cstring('foo')
353
+ buf.put_string('bar')
354
+ buf.put_byte("\x0e")
355
+ buf.put_cstring('foo')
356
+ buf.put_string('bar')
357
+ buf.put_byte("\x00")
358
+
359
+ BSON::ByteBuffer.new(buf.to_s)
360
+ end
361
+
362
+ let(:doc) { Hash.from_bson(buf) }
363
+
364
+ it 'overwrites first value with second value' do
365
+ doc.should == {'foo' => :bar}
366
+ end
367
+ end
368
+ end
313
369
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bson
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.10.1
4
+ version: 4.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -33,7 +33,7 @@ cert_chain:
33
33
  gpvfPNWMwyBDlHaNS3GfO6cRRxBOvEG05GUCsvtTY4Bpe8yjE64wg1ymb47LMOnv
34
34
  Qb1lGORmf/opg45mluKUYl7pQNZHD0d3
35
35
  -----END CERTIFICATE-----
36
- date: 2020-10-13 00:00:00.000000000 Z
36
+ date: 2020-10-21 00:00:00.000000000 Z
37
37
  dependencies: []
38
38
  description: A fully featured BSON specification implementation in Ruby
39
39
  email:
metadata.gz.sig CHANGED
Binary file