bson 4.3.0 → 4.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Rakefile +16 -9
- data/ext/bson/bson_native.c +102 -28
- data/lib/bson.rb +1 -1
- data/lib/bson/active_support.rb +17 -0
- data/lib/bson/array.rb +1 -1
- data/lib/bson/binary.rb +1 -1
- data/lib/bson/boolean.rb +1 -1
- data/lib/bson/code.rb +1 -1
- data/lib/bson/code_with_scope.rb +1 -1
- data/lib/bson/config.rb +1 -1
- data/lib/bson/date.rb +1 -1
- data/lib/bson/date_time.rb +1 -1
- data/lib/bson/decimal128.rb +1 -1
- data/lib/bson/decimal128/builder.rb +1 -1
- data/lib/bson/document.rb +42 -4
- data/lib/bson/environment.rb +1 -1
- data/lib/bson/false_class.rb +1 -1
- data/lib/bson/float.rb +1 -1
- data/lib/bson/hash.rb +1 -1
- data/lib/bson/int32.rb +17 -4
- data/lib/bson/int64.rb +17 -4
- data/lib/bson/integer.rb +2 -2
- data/lib/bson/json.rb +1 -1
- data/lib/bson/max_key.rb +1 -1
- data/lib/bson/min_key.rb +1 -1
- data/lib/bson/nil_class.rb +1 -1
- data/lib/bson/object.rb +1 -1
- data/lib/bson/object_id.rb +1 -1
- data/lib/bson/open_struct.rb +1 -1
- data/lib/bson/regexp.rb +1 -1
- data/lib/bson/registry.rb +1 -1
- data/lib/bson/specialized.rb +1 -1
- data/lib/bson/string.rb +1 -1
- data/lib/bson/symbol.rb +6 -3
- data/lib/bson/time.rb +1 -1
- data/lib/bson/time_with_zone.rb +54 -0
- data/lib/bson/timestamp.rb +1 -1
- data/lib/bson/true_class.rb +1 -1
- data/lib/bson/undefined.rb +1 -1
- data/lib/bson/version.rb +2 -2
- data/spec/bson/array_spec.rb +1 -1
- data/spec/bson/binary_spec.rb +1 -1
- data/spec/bson/boolean_spec.rb +1 -1
- data/spec/bson/byte_buffer_spec.rb +40 -0
- data/spec/bson/code_spec.rb +1 -1
- data/spec/bson/code_with_scope_spec.rb +1 -1
- data/spec/bson/date_spec.rb +1 -1
- data/spec/bson/date_time_spec.rb +1 -1
- data/spec/bson/decimal128_spec.rb +1 -1
- data/spec/bson/document_spec.rb +60 -1
- data/spec/bson/false_class_spec.rb +1 -1
- data/spec/bson/float_spec.rb +1 -1
- data/spec/bson/hash_spec.rb +1 -1
- data/spec/bson/int32_spec.rb +139 -3
- data/spec/bson/int64_spec.rb +139 -3
- data/spec/bson/integer_spec.rb +3 -3
- data/spec/bson/json_spec.rb +1 -1
- data/spec/bson/max_key_spec.rb +1 -1
- data/spec/bson/min_key_spec.rb +1 -1
- data/spec/bson/nil_class_spec.rb +1 -1
- data/spec/bson/object_id_spec.rb +1 -1
- data/spec/bson/object_spec.rb +1 -1
- data/spec/bson/open_struct_spec.rb +1 -1
- data/spec/bson/regexp_spec.rb +1 -1
- data/spec/bson/registry_spec.rb +1 -1
- data/spec/bson/string_spec.rb +1 -1
- data/spec/bson/symbol_spec.rb +3 -3
- data/spec/bson/time_spec.rb +1 -1
- data/spec/bson/time_with_zone_spec.rb +68 -0
- data/spec/bson/timestamp_spec.rb +1 -1
- data/spec/bson/true_class_spec.rb +1 -1
- data/spec/bson/undefined_spec.rb +1 -1
- data/spec/bson_spec.rb +1 -1
- data/spec/spec_helper.rb +15 -1
- data/spec/support/shared_examples.rb +1 -1
- data/spec/support/spec_config.rb +9 -0
- metadata +73 -68
- metadata.gz.sig +0 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
# Copyright (C) 2018-2019 MongoDB Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require "spec_helper"
|
16
|
+
|
17
|
+
context 'when ActiveSupport support is enabled' do
|
18
|
+
before do
|
19
|
+
unless SpecConfig.instance.active_support?
|
20
|
+
skip "ActiveSupport support is not enabled"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'ActiveSupport::TimeWithZone' do
|
25
|
+
let(:cls) { ActiveSupport::TimeWithZone }
|
26
|
+
|
27
|
+
it "shares BSON type with Time" do
|
28
|
+
# ActiveSupport::TimeWithZone#new has no 0-argument version
|
29
|
+
obj = Time.now.in_time_zone("UTC")
|
30
|
+
expect(obj.bson_type).to eq(Time::BSON_TYPE)
|
31
|
+
end
|
32
|
+
|
33
|
+
shared_examples_for 'deserializes as expected' do
|
34
|
+
it 'deserializes to UTC' do
|
35
|
+
# Time zone information is lost during serialization - the time
|
36
|
+
# is always serialized in UTC.
|
37
|
+
rt_obj = Time.from_bson(obj.to_bson)
|
38
|
+
expect(rt_obj.zone).to eq('UTC')
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'deserializes to an equal object' do
|
42
|
+
rt_obj = Time.from_bson(obj.to_bson)
|
43
|
+
expect(rt_obj).to eq(obj)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "#to_bson" do
|
48
|
+
|
49
|
+
context "when the TimeWithZone is not in UTC" do
|
50
|
+
|
51
|
+
let(:obj) { Time.utc(2012, 12, 12, 0, 0, 0).in_time_zone("Pacific Time (US & Canada)") }
|
52
|
+
let(:bson) { [ (obj.utc.to_f * 1000).to_i ].pack(BSON::Int64::PACK) }
|
53
|
+
|
54
|
+
it_behaves_like "a serializable bson element"
|
55
|
+
it_behaves_like 'deserializes as expected'
|
56
|
+
end
|
57
|
+
|
58
|
+
context "when the TimeWithZone is in UTC" do
|
59
|
+
|
60
|
+
let(:obj) { Time.utc(2012, 1, 1, 0, 0, 0).in_time_zone("UTC") }
|
61
|
+
let(:bson) { [ (obj.utc.to_f * 1000).to_i ].pack(BSON::Int64::PACK) }
|
62
|
+
|
63
|
+
it_behaves_like "a serializable bson element"
|
64
|
+
it_behaves_like 'deserializes as expected'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/spec/bson/timestamp_spec.rb
CHANGED
data/spec/bson/undefined_spec.rb
CHANGED
data/spec/bson_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2009-
|
1
|
+
# Copyright (C) 2009-2019 MongoDB Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -25,6 +25,20 @@ require "json"
|
|
25
25
|
require "rspec"
|
26
26
|
require "yaml"
|
27
27
|
|
28
|
+
require 'support/spec_config'
|
29
|
+
|
30
|
+
if SpecConfig.instance.active_support?
|
31
|
+
require "active_support/time"
|
32
|
+
require 'bson/active_support'
|
33
|
+
end
|
34
|
+
|
35
|
+
unless ENV['CI'] || BSON::Environment.jruby?
|
36
|
+
begin
|
37
|
+
require 'byebug'
|
38
|
+
rescue Exception
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
28
42
|
Dir["./spec/support/**/*.rb"].each { |file| require file }
|
29
43
|
|
30
44
|
# Alternate IO class that returns a String from #readbyte.
|
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.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -14,27 +14,26 @@ bindir: bin
|
|
14
14
|
cert_chain:
|
15
15
|
- |
|
16
16
|
-----BEGIN CERTIFICATE-----
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|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IBAQBtXpljL+EXFgH2YRSkYTNn9WKurclJKqaMTJvJoEm2mX1IbAg+BX+i
|
30
|
+
Eb+rKelkjezRqVkurzRjif8RI9aGBpAyfobQfHHJNzHQzSFwhEmwlGDQRgQzrDhN
|
31
|
+
cbkRB2wDgGJNjnjMKLXfeZX+SjWAsHDrOc+Ue9nHs2AdJxCTDgB1MMNGZ1UjLL9/
|
32
|
+
HhO93otEnxwCVijD9ruORb0bT9LlNKosQQEzrhXtOtNK9k7s7G6Gi0BFMOIJDVyq
|
33
|
+
bMYVwXXhV8czdzgkQB/ZPWHSbEWXnmkze1mzvqWBCPOVXYrcnL9cnEl/RoxtS1hr
|
34
|
+
Db6Ac6mCUSYfYHBWpWqxjc45n70i5Xi1
|
36
35
|
-----END CERTIFICATE-----
|
37
|
-
date:
|
36
|
+
date: 2019-01-17 00:00:00.000000000 Z
|
38
37
|
dependencies: []
|
39
38
|
description: A full featured BSON specification implementation, in Ruby
|
40
39
|
email:
|
@@ -54,6 +53,7 @@ files:
|
|
54
53
|
- ext/bson/extconf.rb
|
55
54
|
- ext/bson/native-endian.h
|
56
55
|
- lib/bson.rb
|
56
|
+
- lib/bson/active_support.rb
|
57
57
|
- lib/bson/array.rb
|
58
58
|
- lib/bson/binary.rb
|
59
59
|
- lib/bson/boolean.rb
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/bson/string.rb
|
86
86
|
- lib/bson/symbol.rb
|
87
87
|
- lib/bson/time.rb
|
88
|
+
- lib/bson/time_with_zone.rb
|
88
89
|
- lib/bson/timestamp.rb
|
89
90
|
- lib/bson/true_class.rb
|
90
91
|
- lib/bson/undefined.rb
|
@@ -121,6 +122,7 @@ files:
|
|
121
122
|
- spec/bson/string_spec.rb
|
122
123
|
- spec/bson/symbol_spec.rb
|
123
124
|
- spec/bson/time_spec.rb
|
125
|
+
- spec/bson/time_with_zone_spec.rb
|
124
126
|
- spec/bson/timestamp_spec.rb
|
125
127
|
- spec/bson/true_class_spec.rb
|
126
128
|
- spec/bson/undefined_spec.rb
|
@@ -157,6 +159,7 @@ files:
|
|
157
159
|
- spec/support/driver-spec-tests/decimal128/decimal128-6.json
|
158
160
|
- spec/support/driver-spec-tests/decimal128/decimal128-7.json
|
159
161
|
- spec/support/shared_examples.rb
|
162
|
+
- spec/support/spec_config.rb
|
160
163
|
homepage: http://bsonspec.org
|
161
164
|
licenses:
|
162
165
|
- Apache License Version 2.0
|
@@ -177,76 +180,78 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
180
|
version: 1.3.6
|
178
181
|
requirements: []
|
179
182
|
rubyforge_project: bson
|
180
|
-
rubygems_version: 2.6
|
183
|
+
rubygems_version: 2.7.6
|
181
184
|
signing_key:
|
182
185
|
specification_version: 4
|
183
186
|
summary: Ruby Implementation of the BSON specification
|
184
187
|
test_files:
|
185
|
-
- spec/bson/
|
186
|
-
- spec/bson/min_key_spec.rb
|
187
|
-
- spec/bson/time_spec.rb
|
188
|
-
- spec/bson/int32_spec.rb
|
189
|
-
- spec/bson/code_spec.rb
|
188
|
+
- spec/bson/date_spec.rb
|
190
189
|
- spec/bson/config_spec.rb
|
190
|
+
- spec/bson/int64_spec.rb
|
191
191
|
- spec/bson/undefined_spec.rb
|
192
192
|
- spec/bson/corpus_spec.rb
|
193
|
-
- spec/bson/
|
193
|
+
- spec/bson/code_spec.rb
|
194
|
+
- spec/bson/driver_bson_spec.rb
|
194
195
|
- spec/bson/object_spec.rb
|
195
|
-
- spec/bson/array_spec.rb
|
196
|
-
- spec/bson/hash_spec.rb
|
197
|
-
- spec/bson/date_spec.rb
|
198
|
-
- spec/bson/json_spec.rb
|
199
|
-
- spec/bson/int64_spec.rb
|
200
|
-
- spec/bson/registry_spec.rb
|
201
|
-
- spec/bson/raw_spec.rb
|
202
|
-
- spec/bson/binary_spec.rb
|
203
|
-
- spec/bson/max_key_spec.rb
|
204
|
-
- spec/bson/code_with_scope_spec.rb
|
205
196
|
- spec/bson/date_time_spec.rb
|
206
|
-
- spec/bson/
|
207
|
-
- spec/bson/
|
197
|
+
- spec/bson/raw_spec.rb
|
198
|
+
- spec/bson/min_key_spec.rb
|
199
|
+
- spec/bson/time_with_zone_spec.rb
|
200
|
+
- spec/bson/time_spec.rb
|
201
|
+
- spec/bson/hash_spec.rb
|
202
|
+
- spec/bson/timestamp_spec.rb
|
203
|
+
- spec/bson/int32_spec.rb
|
208
204
|
- spec/bson/byte_buffer_spec.rb
|
205
|
+
- spec/bson/registry_spec.rb
|
206
|
+
- spec/bson/regexp_spec.rb
|
207
|
+
- spec/bson/symbol_spec.rb
|
209
208
|
- spec/bson/string_spec.rb
|
209
|
+
- spec/bson/boolean_spec.rb
|
210
210
|
- spec/bson/open_struct_spec.rb
|
211
|
-
- spec/bson/timestamp_spec.rb
|
212
|
-
- spec/bson/symbol_spec.rb
|
213
211
|
- spec/bson/decimal128_spec.rb
|
212
|
+
- spec/bson/json_spec.rb
|
213
|
+
- spec/bson/array_spec.rb
|
214
|
+
- spec/bson/false_class_spec.rb
|
215
|
+
- spec/bson/true_class_spec.rb
|
216
|
+
- spec/bson/binary_spec.rb
|
217
|
+
- spec/bson/object_id_spec.rb
|
218
|
+
- spec/bson/code_with_scope_spec.rb
|
219
|
+
- spec/bson/nil_class_spec.rb
|
214
220
|
- spec/bson/integer_spec.rb
|
215
221
|
- spec/bson/document_spec.rb
|
222
|
+
- spec/bson/max_key_spec.rb
|
216
223
|
- spec/bson/float_spec.rb
|
217
|
-
- spec/
|
218
|
-
- spec/
|
219
|
-
- spec/
|
220
|
-
- spec/
|
221
|
-
- spec/
|
222
|
-
- spec/support/corpus.
|
223
|
-
- spec/support/corpus-tests/failures/datetime.json
|
224
|
-
- spec/support/corpus-tests/failures/symbol.json
|
225
|
-
- spec/support/corpus-tests/failures/int64.json
|
224
|
+
- spec/support/corpus-tests/string.json
|
225
|
+
- spec/support/corpus-tests/null.json
|
226
|
+
- spec/support/corpus-tests/int32.json
|
227
|
+
- spec/support/corpus-tests/maxkey.json
|
228
|
+
- spec/support/corpus-tests/timestamp.json
|
229
|
+
- spec/support/corpus-tests/failures/binary.json
|
226
230
|
- spec/support/corpus-tests/failures/dbpointer.json
|
231
|
+
- spec/support/corpus-tests/failures/symbol.json
|
227
232
|
- spec/support/corpus-tests/failures/undefined.json
|
228
|
-
- spec/support/corpus-tests/failures/
|
229
|
-
- spec/support/corpus-tests/
|
230
|
-
- spec/support/corpus-tests/boolean.json
|
231
|
-
- spec/support/corpus-tests/oid.json
|
233
|
+
- spec/support/corpus-tests/failures/datetime.json
|
234
|
+
- spec/support/corpus-tests/failures/int64.json
|
232
235
|
- spec/support/corpus-tests/code.json
|
233
|
-
- spec/support/corpus-tests/array.json
|
234
|
-
- spec/support/corpus-tests/double.json
|
235
|
-
- spec/support/corpus-tests/code_w_scope.json
|
236
|
-
- spec/support/corpus-tests/string.json
|
237
236
|
- spec/support/corpus-tests/document.json
|
237
|
+
- spec/support/corpus-tests/double.json
|
238
|
+
- spec/support/corpus-tests/regex.json
|
239
|
+
- spec/support/corpus-tests/oid.json
|
238
240
|
- spec/support/corpus-tests/top.json
|
239
|
-
- spec/support/corpus-tests/
|
240
|
-
- spec/support/corpus-tests/
|
241
|
-
- spec/support/corpus-tests/
|
241
|
+
- spec/support/corpus-tests/boolean.json
|
242
|
+
- spec/support/corpus-tests/array.json
|
243
|
+
- spec/support/corpus-tests/code_w_scope.json
|
242
244
|
- spec/support/corpus-tests/minkey.json
|
243
|
-
- spec/support/corpus
|
245
|
+
- spec/support/corpus.rb
|
244
246
|
- spec/support/shared_examples.rb
|
245
|
-
- spec/support/driver-spec-tests/decimal128/decimal128-1.json
|
246
|
-
- spec/support/driver-spec-tests/decimal128/decimal128-7.json
|
247
|
-
- spec/support/driver-spec-tests/decimal128/decimal128-6.json
|
248
|
-
- spec/support/driver-spec-tests/decimal128/decimal128-5.json
|
249
247
|
- spec/support/driver-spec-tests/decimal128/decimal128-4.json
|
250
|
-
- spec/support/driver-spec-tests/decimal128/decimal128-3.json
|
251
248
|
- spec/support/driver-spec-tests/decimal128/decimal128-2.json
|
249
|
+
- spec/support/driver-spec-tests/decimal128/decimal128-5.json
|
250
|
+
- spec/support/driver-spec-tests/decimal128/decimal128-3.json
|
251
|
+
- spec/support/driver-spec-tests/decimal128/decimal128-6.json
|
252
|
+
- spec/support/driver-spec-tests/decimal128/decimal128-1.json
|
253
|
+
- spec/support/driver-spec-tests/decimal128/decimal128-7.json
|
254
|
+
- spec/support/spec_config.rb
|
252
255
|
- spec/support/common_driver.rb
|
256
|
+
- spec/spec_helper.rb
|
257
|
+
- spec/bson_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|