tests that already pass

This commit is contained in:
Mike Dirolf 2009-03-02 10:49:27 -05:00
parent 6a71b7e612
commit 544a044105
3 changed files with 56 additions and 0 deletions

View File

@ -33,6 +33,13 @@ class AdminTest < Test::Unit::TestCase
assert_equal :slow_only, @admin.profiling_level
@admin.profiling_level = :off
assert_equal :off, @admin.profiling_level
@admin.profiling_level = :all
assert_equal :all, @admin.profiling_level
begin
@admin.profiling_level = :medium
fail "shouldn't be able to do this"
rescue
end
end
def test_profiling_info

View File

@ -40,6 +40,17 @@ class CursorTest < Test::Unit::TestCase
end
end
def test_refill_via_get_more
1000.times { |i|
@@coll.insert('a' => i)
}
count = 0
@@coll.find.each { |obj|
count += obj['a']
}
assert_equal 499501, count
end
def test_close_after_query_sent
begin
cursor = @@coll.find('a' => 1)

View File

@ -233,6 +233,12 @@ class DBAPITest < Test::Unit::TestCase
assert !@@db.collection_names.include?(@@coll_full_name)
end
def test_other_drop
assert @@db.collection_names.include?(@@coll_full_name)
@@coll.drop
assert !@@db.collection_names.include?(@@coll_full_name)
end
def test_collection_names
names = @@db.collection_names
assert names.length >= 1
@ -277,6 +283,7 @@ class DBAPITest < Test::Unit::TestCase
def test_index_information
name = @@db.create_index(@@coll.name, 'a')
list = @@db.index_information(@@coll.name)
assert_equal @@coll.index_information, list
assert_equal 1, list.length
info = list[0]
@ -368,6 +375,37 @@ class DBAPITest < Test::Unit::TestCase
@@db.strict = false
@@db.drop_collection('foobar')
end
# Now we're not in strict mode - should succeed
@@db.create_collection('foobar')
@@db.create_collection('foobar')
@@db.drop_collection('foobar')
end
def test_replace
assert_equal @@coll.count, 1
assert_equal @@coll.find_first["a"], 1
@@coll.replace({"a" => 1}, {"a" => 2})
assert_equal @@coll.count, 1
assert_equal @@coll.find_first["a"], 2
@@coll.replace({"b" => 1}, {"a" => 3})
assert_equal @@coll.count, 1
assert_equal @@coll.find_first["a"], 2
end
def test_repsert
assert_equal @@coll.count, 1
assert_equal @@coll.find_first["a"], 1
@@coll.repsert({"a" => 1}, {"a" => 2})
assert_equal @@coll.count, 1
assert_equal @@coll.find_first["a"], 2
@@coll.repsert({"b" => 1}, {"a" => 3})
assert_equal @@coll.count, 2
assert @@coll.find_first({"a" => 3})
end
def test_to_a