Test using non-ObjectID _id value.

This commit is contained in:
Jim Menard 2009-01-26 08:51:27 -05:00
parent b337150eb2
commit 4ef032b6f9
1 changed files with 10 additions and 0 deletions

View File

@ -286,6 +286,16 @@ class DBAPITest < Test::Unit::TestCase
assert_equal regex, rows[0]['b']
end
def test_non_oid_id
# Note: can't use Time.new because that will include fractional seconds,
# which Mongo does not store.
t = Time.at(1234567890)
@coll << {'_id' => t}
rows = @coll.find({'_id' => t}).to_a
assert_equal 1, rows.length
assert_equal t, rows[0]['_id']
end
def test_strict
assert !@db.strict?
@db.strict = true