minor: ensure index tests

This commit is contained in:
Kyle Banker 2010-12-15 15:16:36 -05:00
parent 8b1f20b3cb
commit 96e1adbb23

View File

@ -578,13 +578,16 @@ class TestCollection < Test::Unit::TestCase
@@test.ensure_index([["x", Mongo::ASCENDING]]) @@test.ensure_index([["x", Mongo::ASCENDING]])
assert @@test.index_information.keys.include? "x_1" assert @@test.index_information.keys.include? "x_1"
@@test.drop_index("x_1") @@test.ensure_index([["type", 1], ["date", -1]])
assert_equal 2, @@test.index_information.keys.count assert @@test.index_information.keys.include? "type_1_date_-1"
@@test.drop_index("x_-1")
assert_equal 1, @@test.index_information.keys.count
@@test.ensure_index([["x", Mongo::DESCENDING]], {}) #should work as not cached. @@test.drop_index("x_1")
assert_equal 3, @@test.index_information.keys.count
@@test.drop_index("x_-1")
assert_equal 2, @@test.index_information.keys.count assert_equal 2, @@test.index_information.keys.count
@@test.ensure_index([["x", Mongo::DESCENDING]], {})
assert_equal 3, @@test.index_information.keys.count
assert @@test.index_information.keys.include? "x_-1" assert @@test.index_information.keys.include? "x_-1"
# Make sure that drop_index expires cache properly # Make sure that drop_index expires cache properly