diff --git a/tests/test_cursor.rb b/tests/test_cursor.rb index 95e081e..cab6985 100644 --- a/tests/test_cursor.rb +++ b/tests/test_cursor.rb @@ -59,6 +59,29 @@ class CursorTest < Test::Unit::TestCase assert_equal 499501, count end + def test_refill_via_get_more_alt_coll + coll = @@db.collection('test-alt-coll') + coll.clear + coll.insert('a' => 1) # collection not created until it's used + + 1000.times { |i| + coll.insert('a' => i) + } + count = 0 + coll.find.each { |obj| + count += obj['a'] + } + + # do the same thing again for debugging + count2 = 0 + coll.find.each { |obj| + count2 += obj['a'] + } + + assert_equal count, count2 + assert_equal 499501, count + end + def test_close_after_query_sent begin cursor = @@coll.find('a' => 1)