bson 1.8.3.rc0 → 1.8.3.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bson might be problematic. Click here for more details.

@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 93e4cdc702342676605dc33402254b3952cf89e4
4
+ data.tar.gz: 5e5f49e7f3d8f7fd4051e99ab46c1a4476222552
5
+ SHA512:
6
+ metadata.gz: 177cfd64dd90bdbd485f4ae79a46205c6e9c9b30d3cf9323e16db5a759d47f835911e2dd61ece4b8d61fd30293ce132b7a727a0f218af7d6d58a20c3d460bf66
7
+ data.tar.gz: 07df44987a5dd10d61263392d9b0d2ff794a34616eb83294e79717155922fe02dd15191a27f09a09c4068ceea96797c14d209fb77d1d100296a381b49c371f78
Binary file
data.tar.gz.sig CHANGED
Binary file
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.8.3.rc0
1
+ 1.8.3.rc1
@@ -132,7 +132,7 @@ module BSON
132
132
 
133
133
  # Returns the array stored in the buffer.
134
134
  # Implemented to ensure an API compatible with BSON extension.
135
- def unpack(arg)
135
+ def unpack
136
136
  @buf.to_a
137
137
  end
138
138
 
@@ -398,7 +398,7 @@ module BSON
398
398
  self.class.serialize_key(buf, key)
399
399
  end
400
400
 
401
- def serialize_dbref_element(buf, key, val)
401
+ def serialize_dbref_element(buf, key, val) # this does NOT use the BSON "\x0C" DBPointer type
402
402
  oh = BSON::OrderedHash.new
403
403
  oh['$ref'] = val.namespace
404
404
  oh['$id'] = val.object_id
@@ -58,6 +58,68 @@ class BSONTest < Test::Unit::TestCase
58
58
  assert_equal doc, @encoder.deserialize(bson)
59
59
  end
60
60
 
61
+ def test_interface
62
+ doc = { 'a' => 1 }
63
+ bson = BSON.serialize(doc)
64
+ assert_equal doc, BSON.deserialize(bson)
65
+ end
66
+
67
+ def test_read_bson_document
68
+ bson_file_data_h_star = ["21000000075f6964005115883c3d75c94d3aa18b63016100000000000000f03f00"]
69
+ strio = StringIO.new(bson_file_data_h_star.pack('H*'))
70
+ bson = BSON.read_bson_document(strio)
71
+ doc = {"_id"=>BSON::ObjectId('5115883c3d75c94d3aa18b63'), "a"=>1.0}
72
+ assert_equal doc, bson
73
+ end
74
+
75
+ def test_bson_ruby_interface
76
+ doc = { 'a' => 1 }
77
+ buf = BSON_RUBY.serialize(doc)
78
+ bson = BSON::BSON_RUBY.new
79
+ bson.instance_variable_set(:@buf, buf)
80
+ assert_equal [12, 0, 0, 0, 16, 97, 0, 1, 0, 0, 0, 0], bson.to_a
81
+ assert_equal "\f\x00\x00\x00\x10a\x00\x01\x00\x00\x00\x00", bson.to_s
82
+ assert_equal [12, 0, 0, 0, 16, 97, 0, 1, 0, 0, 0, 0], bson.unpack
83
+ end
84
+
85
+ def test_bson_ruby_hex_dump
86
+ doc = { 'a' => 1 }
87
+ buf = BSON_RUBY.serialize(doc)
88
+ bson = BSON_RUBY.new
89
+ bson.instance_variable_set(:@buf, buf)
90
+ doc_hex_dump = " 0: 0C 00 00 00 10 61 00 01\n 8: 00 00 00 00"
91
+ assert_equal doc_hex_dump, bson.hex_dump
92
+ end
93
+
94
+ def test_bson_ruby_dbref_not_used
95
+ buf = BSON::ByteBuffer.new
96
+ val = ns = 'namespace'
97
+
98
+ # Make a hole for the length
99
+ len_pos = buf.position
100
+ buf.put_int(0)
101
+
102
+ # Save the string
103
+ start_pos = buf.position
104
+ BSON::BSON_RUBY.serialize_cstr(buf, val)
105
+ end_pos = buf.position
106
+
107
+ # Put the string size in front
108
+ buf.put_int(end_pos - start_pos, len_pos)
109
+
110
+ # Go back to where we were
111
+ buf.position = end_pos
112
+
113
+ oid = ObjectId.new
114
+ buf.put_array(oid.to_a)
115
+ buf.rewind
116
+
117
+ bson = BSON::BSON_RUBY.new
118
+ bson.instance_variable_set(:@buf, buf)
119
+
120
+ assert_equal DBRef.new(ns, oid).to_s, bson.deserialize_dbref_data(buf).to_s
121
+ end
122
+
61
123
  def test_require_hash
62
124
  assert_raise_error InvalidDocument, "takes a Hash" do
63
125
  BSON.serialize('foo')
@@ -191,8 +253,14 @@ class BSONTest < Test::Unit::TestCase
191
253
  end
192
254
 
193
255
  def test_code
194
- doc = {'$where' => Code.new('this.a.b < this.b')}
256
+ code = Code.new('this.a.b < this.b')
257
+ assert_equal 17, code.length
258
+ assert_match /<BSON::Code:.*@data="this.a.b < this.b".*>/, code.inspect
259
+ doc = {'$where' => code}
195
260
  assert_doc_pass(doc)
261
+ code = 'this.c.d < this.e'.to_bson_code # core_ext.rb
262
+ assert_equal BSON::Code, code.class
263
+ assert_equal code, code.to_bson_code
196
264
  end
197
265
 
198
266
  def test_code_with_symbol
@@ -343,8 +411,11 @@ class BSONTest < Test::Unit::TestCase
343
411
 
344
412
  def test_dbref
345
413
  oid = ObjectId.new
414
+ ns = 'namespace'
346
415
  doc = {}
347
- doc['dbref'] = DBRef.new('namespace', oid)
416
+ dbref = DBRef.new(ns, oid)
417
+ assert_equal({"$id"=>oid, "$ns"=>ns}, dbref.to_hash)
418
+ doc['dbref'] = dbref
348
419
  bson = @encoder.serialize(doc)
349
420
  doc2 = @encoder.deserialize(bson)
350
421
 
@@ -15,6 +15,16 @@ class ByteBufferTest < Test::Unit::TestCase
15
15
  assert_equal 0, @buf.length
16
16
  end
17
17
 
18
+ def test_initialize_with_string_and_clear
19
+ @buf = ByteBuffer.new("a")
20
+ assert_equal 1, @buf.size
21
+ assert_equal 1, @buf.position
22
+ @buf.clear
23
+ assert_equal 0, @buf.position
24
+ assert_equal "", @buf.to_s
25
+ assert_equal 0, @buf.size
26
+ end
27
+
18
28
  def test_nil_get_returns_one_byte
19
29
  @buf.put_array([1, 2, 3, 4])
20
30
  @buf.rewind
@@ -202,5 +212,4 @@ class ByteBufferTest < Test::Unit::TestCase
202
212
  assert_not_equal @buf, 123
203
213
  assert_not_equal @buf, nil
204
214
  end
205
-
206
215
  end
@@ -2,6 +2,11 @@ require 'test_helper'
2
2
 
3
3
  class TimestampTest < Test::Unit::TestCase
4
4
 
5
+ def test_timestamp_to_s
6
+ t1 = Timestamp.new(5000, 200)
7
+ assert_equal "seconds: 5000, increment: 200", t1.to_s
8
+ end
9
+
5
10
  def test_timestamp_equality
6
11
  t1 = Timestamp.new(5000, 200)
7
12
  t2 = Timestamp.new(5000, 200)
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bson
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3.rc0
5
- prerelease: 6
4
+ version: 1.8.3.rc1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tyler Brock
@@ -13,35 +12,28 @@ authors:
13
12
  autorequire:
14
13
  bindir: bin
15
14
  cert_chain:
16
- - !binary |-
17
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURPRENDQWlDZ0F3SUJB
18
- Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREJDTVJRd0VnWURWUVFEREF0a2Nt
19
- bDIKWlhJdGNuVmllVEVWTUJNR0NnbVNKb21UOGl4a0FSa1dCVEV3WjJWdU1S
20
- TXdFUVlLQ1pJbWlaUHlMR1FCR1JZRApZMjl0TUI0WERURXpNREl3TVRFME1U
21
- RXpOMW9YRFRFME1ESXdNVEUwTVRFek4xb3dRakVVTUJJR0ExVUVBd3dMClpI
22
- SnBkbVZ5TFhKMVlua3hGVEFUQmdvSmtpYUprL0lzWkFFWkZnVXhNR2RsYmpF
23
- VE1CRUdDZ21TSm9tVDhpeGsKQVJrV0EyTnZiVENDQVNJd0RRWUpLb1pJaHZj
24
- TkFRRUJCUUFEZ2dFUEFEQ0NBUW9DZ2dFQkFORmRTQWE4ZlJtMQpiQU05emE2
25
- WjBmQUg0ZzAyYnFNMU5Hbnc4ekpRckUvUEZyRmZZNklGQ1QyQXNMZk93cjFt
26
- YVZtN2lVMStrZFZJCklRK2lJLzkrRStBckorcmJHVjNkRFBRK1NMbDNtTFQr
27
- dlhqZmpjeE1xSTJJVzZVdVZ0dDJVM1J4ZDRRVTBrZFQKSnhtY1B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0NrHIw1Qhe0tAGJ9V1u3ky8gyxe0SM
33
+ 8v7zLF2XliYbfurYIwkcXs8yPn8ggApBIy9bX6VJxRs/l2+UvqzaHIFaFy/F8/GP
34
+ RNTuXsVG5NDACo7Q
35
+ -----END CERTIFICATE-----
36
+ date: 2013-02-27 00:00:00.000000000 Z
45
37
  dependencies: []
46
38
  description: A Ruby BSON implementation for MongoDB. For more information about Mongo,
47
39
  see http://www.mongodb.org. For more information on BSON, see http://www.bsonspec.org.
@@ -81,27 +73,26 @@ files:
81
73
  - test/bson/timestamp_test.rb
82
74
  homepage: http://www.mongodb.org
83
75
  licenses: []
76
+ metadata: {}
84
77
  post_install_message:
85
78
  rdoc_options: []
86
79
  require_paths:
87
80
  - lib
88
81
  required_ruby_version: !ruby/object:Gem::Requirement
89
- none: false
90
82
  requirements:
91
- - - ! '>='
83
+ - - '>='
92
84
  - !ruby/object:Gem::Version
93
85
  version: '0'
94
86
  required_rubygems_version: !ruby/object:Gem::Requirement
95
- none: false
96
87
  requirements:
97
- - - ! '>'
88
+ - - '>'
98
89
  - !ruby/object:Gem::Version
99
90
  version: 1.3.1
100
91
  requirements: []
101
92
  rubyforge_project: bson
102
- rubygems_version: 1.8.23
93
+ rubygems_version: 2.0.0
103
94
  signing_key:
104
- specification_version: 3
95
+ specification_version: 4
105
96
  summary: Ruby implementation of BSON
106
97
  test_files:
107
98
  - test/bson/binary_test.rb
metadata.gz.sig CHANGED
Binary file