fixed tests

This commit is contained in:
Jim Menard 2009-01-28 15:42:42 -05:00
parent dc3ef378d3
commit 086fbaf6e5
1 changed files with 3 additions and 2 deletions

View File

@ -62,16 +62,17 @@ class DBTest < Test::Unit::TestCase
coll = db.collection('test') coll = db.collection('test')
coll.clear coll.clear
# new id gets added to returned object
obj = coll.insert('name' => 'Fred', 'age' => 42) obj = coll.insert('name' => 'Fred', 'age' => 42)
row = coll.find({'name' => 'Fred'}, :limit => 1).next_object row = coll.find({'name' => 'Fred'}, :limit => 1).next_object
oid = row.delete('_id') oid = row['_id']
assert_not_nil oid assert_not_nil oid
assert_equal obj, row assert_equal obj, row
oid = XGen::Mongo::Driver::ObjectID.new oid = XGen::Mongo::Driver::ObjectID.new
obj = coll.insert('_id' => oid, 'name' => 'Barney', 'age' => 41) obj = coll.insert('_id' => oid, 'name' => 'Barney', 'age' => 41)
row = coll.find({'name' => 'Barney'}, :limit => 1).next_object row = coll.find({'name' => 'Barney'}, :limit => 1).next_object
db_oid = row.delete('_id') db_oid = row['_id']
assert_equal oid, db_oid assert_equal oid, db_oid
assert_equal obj, row assert_equal obj, row