bson 4.2.1-java → 4.2.2-java

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: 0943fd6b5a5e056e3a5ec9f82d6ff228acf678da
4
- data.tar.gz: 40bd34efa88bfc193570ea92aa30bf8ea14a7bdb
3
+ metadata.gz: 648a36ae43d7444b7734ae5207f455dc385763ef
4
+ data.tar.gz: de8db45eca2fc5c599fc43563547f2ebfc3ab324
5
5
  SHA512:
6
- metadata.gz: 4a15fb476ce3e5a594fed1960360f6fa8e1940cdde17573024d8d9fee551e1c49f1d6687d8279ff55ea505ea93f2bcb2abfba5c6741d9696f611dfb24524304e
7
- data.tar.gz: d6d0c5456eb12da27b80c27c731e145d79668ead9170f4c2fe1a25b1090b5728aee15b17d07151b63e62bfbf9e2bcc2dc169a03029d4b63e8ad5fb9149f8767e
6
+ metadata.gz: b248993776b32d0f628053b89e474006f6777390ef0329a63fd30665d1240d4bb5b3801bd7873ff1cda33b7c5d66fa2ad6d3102fea9b78f53cb50ed6a9395c28
7
+ data.tar.gz: ab739128803d604a4eec24ddedd2342d7916966234de8663b49f5174efb119347897472ba0209caf136b659c2fcf54bd80964d624dd2bb83064a77671bd0a15f
Binary file
data.tar.gz.sig CHANGED
Binary file
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: java
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
+ Y29tMB4XDTE3MDcwMzEyMT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qitYYdDoq3dup
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:
metadata.gz.sig CHANGED
Binary file