bson 4.2.1 → 4.2.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: b0ac7ae0ca768ef98d4623098afcfd7a6274ae1c
4
- data.tar.gz: 8ee3b34cb7a96012a8d849e0804699338f426264
3
+ metadata.gz: 0e76c5872004b8c218e35db5ae4db7e2a0f69449
4
+ data.tar.gz: 40dc1aac62c0f7a59eed2a6a9619743927a66ae6
5
5
  SHA512:
6
- metadata.gz: ae110fdef5bf56e3c4afebd46e383b9e69496fc9b10bc4ea7f414020f101d054173c42101d80f2f4be111e234ffc73ec86d29f27bbffe80b314e51c5a4707fc4
7
- data.tar.gz: 252f9e291534603084f3087b286a41deeb5c3562121e2bb1886acd5cf2f1ff43458985cf4c27d2dd874ae43d00262a24b23d9ba3925dbbf6b7ea43dbdb927c89
6
+ metadata.gz: 5e820f483f475073365955ec222c92771ca5ed5bc2547c82eeabc353a1dd9153e1a5fff8a878428ba0e781e8f2c8f2d341b858423407469d7d6947324f3ff3b8
7
+ data.tar.gz: c0fdd409db1055211502f7f2b3527d298d6e0e6ece5bde64418b0291e709e50eda0471951ccc10c57a86f9cdcd7e2ee9353bda19c7fd02f61fcc593612db65c0
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -18,6 +18,7 @@ require 'bson/decimal128/builder'
18
18
  module BSON
19
19
 
20
20
  class Decimal128
21
+ include JSON
21
22
 
22
23
  # A Decimal128 is type 0x13 in the BSON spec.
23
24
  #
@@ -193,6 +193,11 @@ module BSON
193
193
 
194
194
  private
195
195
 
196
+ def initialize_copy(other)
197
+ generate_data
198
+ other.instance_variable_set(:@raw_data, @raw_data)
199
+ end
200
+
196
201
  def generate_data
197
202
  repair if defined?(@data)
198
203
  @raw_data ||= @@generator.next_object_id
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module BSON
16
- VERSION = "4.2.1".freeze
16
+ VERSION = "4.2.2".freeze
17
17
  end
@@ -1257,6 +1257,8 @@ describe BSON::Decimal128 do
1257
1257
  it "returns the decimal128 with $numberDecimal key" do
1258
1258
  expect(object.as_json).to eq({ "$numberDecimal" => object.to_s })
1259
1259
  end
1260
+
1261
+ it_behaves_like "a JSON serializable object"
1260
1262
  end
1261
1263
 
1262
1264
  describe "::BSON_TYPE" do
@@ -64,10 +64,10 @@ describe BSON::Int64 do
64
64
 
65
65
  context "when the integer is within the MRI Fixnum range" do
66
66
 
67
- let(:integer) { BSON::Integer::MAX_32BIT + 1 }
67
+ let(:integer) { 2**30 - 1 }
68
68
 
69
69
  let(:bson) do
70
- BSON::ByteBuffer.new(integer.to_bson.to_s)
70
+ BSON::ByteBuffer.new(BSON::Int64.new(integer).to_bson.to_s)
71
71
  end
72
72
 
73
73
  context "when on JRuby", if: BSON::Environment.jruby? do
@@ -77,15 +77,22 @@ describe BSON::Int64 do
77
77
  end
78
78
  end
79
79
 
80
- context "when using MRI", unless: BSON::Environment.jruby? do
80
+ context "when using MRI < 2.4", if: (!BSON::Environment.jruby? && RUBY_VERSION < '2.4') do
81
81
 
82
82
  it "deserializes to a Fixnum object" do
83
83
  expect(described_class.from_bson(bson).class).to be(Fixnum)
84
84
  end
85
85
  end
86
+
87
+ context "when using MRI >= 2.4", if: (!BSON::Environment.jruby? && RUBY_VERSION >= '2.4') do
88
+
89
+ it "deserializes to an Integer object" do
90
+ expect(described_class.from_bson(bson).class).to be(Integer)
91
+ end
92
+ end
86
93
  end
87
94
 
88
- context "when the 64-bit integer is the BSON max and thus larger than the MRI Fixnum range" do
95
+ context "when the 64-bit integer is the BSON max and thus larger than the MRI Fixnum range on all architectures" do
89
96
 
90
97
  let(:integer) { Integer::MAX_64BIT }
91
98
 
@@ -100,12 +107,19 @@ describe BSON::Int64 do
100
107
  end
101
108
  end
102
109
 
103
- context "when using MRI", unless: BSON::Environment.jruby? do
110
+ context "when using MRI < 2.4", if: (!BSON::Environment.jruby? && RUBY_VERSION < '2.4') do
104
111
 
105
112
  it "deserializes to a Bignum object" do
106
113
  expect(described_class.from_bson(bson).class).to be(Bignum)
107
114
  end
108
115
  end
116
+
117
+ context "when using MRI >= 2.4", if: (!BSON::Environment.jruby? && RUBY_VERSION >= '2.4') do
118
+
119
+ it "deserializes to an Integer object" do
120
+ expect(described_class.from_bson(bson).class).to be(Integer)
121
+ end
122
+ end
109
123
  end
110
124
  end
111
125
 
@@ -392,6 +392,43 @@ describe BSON::ObjectId do
392
392
  end
393
393
  end
394
394
 
395
+ describe "#clone" do
396
+
397
+ context "when the data has not been generated yet" do
398
+
399
+ let!(:object_id) do
400
+ described_class.new
401
+ end
402
+
403
+ let!(:clone) do
404
+ object_id.clone
405
+ end
406
+
407
+ it "generates and copies the data" do
408
+ expect(clone).to eq(object_id)
409
+ end
410
+ end
411
+
412
+ context "when the data has been generated" do
413
+
414
+ let!(:object_id) do
415
+ described_class.new
416
+ end
417
+
418
+ let(:clone) do
419
+ object_id.clone
420
+ end
421
+
422
+ before do
423
+ object_id.to_s
424
+ end
425
+
426
+ it "copies the data" do
427
+ expect(clone).to eq(object_id)
428
+ end
429
+ end
430
+ end
431
+
395
432
  describe "#inspect" do
396
433
 
397
434
  let(:object_id) do
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.2.1
4
+ version: 4.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -16,7 +16,7 @@ cert_chain:
16
16
  -----BEGIN CERTIFICATE-----
17
17
  MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtkcml2
18
18
  ZXItcnVieTEVMBMGCgmSJomT8ixkARkWBTEwZ2VuMRMwEQYKCZImiZPyLGQBGRYD
19
- Y29tMB4XDTE2MDQwODE0MTE0NVoXDTE3MDQwODE0MTE0NVowQjEUMBIGA1UEAwwL
19
+ Y29tMB4XDTE3MDcwMzEyM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RqitYYdDoq3dup
33
+ YbzsDYb5G4lbzCmqX2pu0ravi0XF9qDOgvm4j7ss9BnGuwQhhb44nevlIEv+sTg4
34
+ UgLdYyyGANc+TOKLFmx0eAJlCljAurbX7ctO2XI0f1AUdEYSqGzut+datXK/9nwQ
35
+ FACf8zd11PEds/Opai2Qp4aOBgaxXhhFG357umy1vRs=
36
36
  -----END CERTIFICATE-----
37
- date: 2016-12-19 00:00:00.000000000 Z
37
+ date: 2017-07-03 00:00:00.000000000 Z
38
38
  dependencies: []
39
39
  description: A full featured BSON specification implementation, in Ruby
40
40
  email:
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: 1.3.6
178
178
  requirements: []
179
179
  rubyforge_project: bson
180
- rubygems_version: 2.6.8
180
+ rubygems_version: 2.6.11
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: Ruby Implementation of the BSON specification
metadata.gz.sig CHANGED
Binary file