This commit is contained in:
Kyle Banker 2010-04-12 12:01:50 -04:00
parent b9f579876c
commit 860ab356d2
2 changed files with 7 additions and 1 deletions

View File

@ -116,7 +116,7 @@ module BSON
raise InvalidDocument, "Document is too large (#{@buf.size}). BSON documents are limited to 4MB (#{4 * 1024 * 1024})."
end
@buf.put_int(@buf.size, 0)
self
@buf
end
# Returns the array stored in the buffer.

View File

@ -22,6 +22,12 @@ class BSONTest < Test::Unit::TestCase
include BSON
def test_serialize_returns_byte_buffer
doc = {'doc' => 'hello, world'}
bson = BSON.serialize(doc)
assert bson.is_a?(ByteBuffer)
end
def test_deprecated_bson_module
doc = {'doc' => 'hello, world'}
bson = BSON.serialize(doc)