tests that already pass
This commit is contained in:
parent
6a71b7e612
commit
544a044105
@ -33,6 +33,13 @@ class AdminTest < Test::Unit::TestCase
|
|||||||
assert_equal :slow_only, @admin.profiling_level
|
assert_equal :slow_only, @admin.profiling_level
|
||||||
@admin.profiling_level = :off
|
@admin.profiling_level = :off
|
||||||
assert_equal :off, @admin.profiling_level
|
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
|
end
|
||||||
|
|
||||||
def test_profiling_info
|
def test_profiling_info
|
||||||
|
@ -40,6 +40,17 @@ class CursorTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
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
|
def test_close_after_query_sent
|
||||||
begin
|
begin
|
||||||
cursor = @@coll.find('a' => 1)
|
cursor = @@coll.find('a' => 1)
|
||||||
|
@ -233,6 +233,12 @@ class DBAPITest < Test::Unit::TestCase
|
|||||||
assert !@@db.collection_names.include?(@@coll_full_name)
|
assert !@@db.collection_names.include?(@@coll_full_name)
|
||||||
end
|
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
|
def test_collection_names
|
||||||
names = @@db.collection_names
|
names = @@db.collection_names
|
||||||
assert names.length >= 1
|
assert names.length >= 1
|
||||||
@ -277,6 +283,7 @@ class DBAPITest < Test::Unit::TestCase
|
|||||||
def test_index_information
|
def test_index_information
|
||||||
name = @@db.create_index(@@coll.name, 'a')
|
name = @@db.create_index(@@coll.name, 'a')
|
||||||
list = @@db.index_information(@@coll.name)
|
list = @@db.index_information(@@coll.name)
|
||||||
|
assert_equal @@coll.index_information, list
|
||||||
assert_equal 1, list.length
|
assert_equal 1, list.length
|
||||||
|
|
||||||
info = list[0]
|
info = list[0]
|
||||||
@ -368,6 +375,37 @@ class DBAPITest < Test::Unit::TestCase
|
|||||||
@@db.strict = false
|
@@db.strict = false
|
||||||
@@db.drop_collection('foobar')
|
@@db.drop_collection('foobar')
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def test_to_a
|
def test_to_a
|
||||||
|
Loading…
Reference in New Issue
Block a user