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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -1
- data/lib/bson/version.rb +1 -1
- data/spec/bson/byte_buffer_spec.rb +43 -2
- data/spec/bson/hash_spec.rb +56 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06e075081379ce36a9733b97e65fe9ddedf5c02abbff44f4f80900996f978382
|
4
|
+
data.tar.gz: 291dbafc79f5a81287304b17976baefa9c218ae4a9728535ac045f99f61e9a41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50915432ff0dd69ec3a2be50f718a5dfcdc5bc000d619652be55e3543493b2d5f91074018b96e17dcd4f20efcd56bde31204c4badc24a8f46a99c1effb2f1602
|
7
|
+
data.tar.gz: 897db48b82f0dd8af1a1e3597cb8bcbf3d9d0679211e19407ffcf872db1615594dfce9b18baedfda3e7d299c9519cc63c047e026866f8b767e05dff10b3e7ae9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
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���ވ���
|
data/lib/bson/version.rb
CHANGED
@@ -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
|
data/spec/bson/hash_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|