2010-09-09 19:58:51 +00:00
|
|
|
require './test/test_helper'
|
2010-07-07 21:04:45 +00:00
|
|
|
require 'rubygems'
|
|
|
|
require 'json'
|
|
|
|
|
|
|
|
class JSONTest < Test::Unit::TestCase
|
|
|
|
|
|
|
|
def test_object_id_as_json
|
2010-10-12 19:39:28 +00:00
|
|
|
id = BSON::ObjectId.new
|
|
|
|
p id.to_json
|
|
|
|
|
2010-07-07 21:04:45 +00:00
|
|
|
obj = {'_id' => id}
|
2010-10-12 19:39:28 +00:00
|
|
|
assert_equal "{\"_id\":#{id.to_json}}", obj.to_json
|
2010-07-07 21:04:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|