2010-07-07 21:04:45 +00:00
|
|
|
require 'test/test_helper'
|
|
|
|
require 'rubygems'
|
|
|
|
require 'json'
|
|
|
|
|
|
|
|
class JSONTest < Test::Unit::TestCase
|
|
|
|
|
|
|
|
include Mongo
|
|
|
|
include BSON
|
|
|
|
|
|
|
|
def test_object_id_as_json
|
2010-09-09 18:27:34 +00:00
|
|
|
id = ObjectId.new
|
2010-07-07 21:04:45 +00:00
|
|
|
obj = {'_id' => id}
|
|
|
|
assert_equal "{\"_id\":{\"$oid\": \"#{id.to_s}\"}}", obj.to_json
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|