included old BSON constant for deprecation warning
This commit is contained in:
parent
372f578389
commit
6139c27df0
|
@ -3,9 +3,34 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|||
module Mongo
|
||||
module BSON
|
||||
VERSION = "0.19.2"
|
||||
def self.serialize(obj, check_keys=false, move_id=false)
|
||||
warn "BSON has been deprecated. Use Mongo::BSON_CODER instead."
|
||||
BSON_CODER.serialize(obj, check_keys, move_id)
|
||||
end
|
||||
|
||||
|
||||
def self.deserialize(buf=nil)
|
||||
warn "BSON has been deprecated. Use Mongo::BSON_CODER instead."
|
||||
BSON_CODER.deserialize(buf)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# This just exists for deprecation warnings. Will be removed in an upcoming version.
|
||||
module BSON
|
||||
def self.serialize(obj, check_keys=false, move_id=false)
|
||||
warn "BSON has been deprecated. Use Mongo::BSON_CODER instead."
|
||||
BSON_CODER.serialize(obj, check_keys, move_id)
|
||||
end
|
||||
|
||||
|
||||
def self.deserialize(buf=nil)
|
||||
warn "BSON has been deprecated. Use Mongo::BSON_CODER instead."
|
||||
BSON_CODER.deserialize(buf)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
begin
|
||||
# Need this for running test with and without c ext in Ruby 1.9.
|
||||
raise LoadError if ENV['TEST_MODE'] && !ENV['C_EXT']
|
||||
|
|
|
@ -22,6 +22,13 @@ class BSONTest < Test::Unit::TestCase
|
|||
|
||||
include Mongo
|
||||
|
||||
|
||||
def test_deprecated_bson_module
|
||||
doc = {'doc' => 'hello, world'}
|
||||
bson = BSON.serialize(doc)
|
||||
assert_equal doc, BSON.deserialize(bson)
|
||||
end
|
||||
|
||||
def test_string
|
||||
doc = {'doc' => 'hello, world'}
|
||||
bson = bson = Mongo::BSON_CODER.serialize(doc)
|
||||
|
|
Loading…
Reference in New Issue