test/grid_io_test.rb in mongo-1.3.0 vs test/grid_io_test.rb in mongo-1.3.1
- old
+ new
@@ -67,9 +67,27 @@
file = GridIO.new(@files, @chunks, nil, "r", :query => {:_id => @file.files_id})
string = file.gets
assert_equal 10, string.length
end
+ should "read to the end of the file one line at a time" do
+ file = GridIO.new(@files, @chunks, nil, "r", :query => {:_id => @file.files_id})
+ bytes = 0
+ while string = file.gets
+ bytes += string.length
+ end
+ assert_equal 1_000_000, bytes
+ end
+
+ should "read to the end of the file one multi-character separator at a time" do
+ file = GridIO.new(@files, @chunks, nil, "r", :query => {:_id => @file.files_id})
+ bytes = 0
+ while string = file.gets("45")
+ bytes += string.length
+ end
+ assert_equal 1_000_000, bytes
+ end
+
should "read to a given separator" do
file = GridIO.new(@files, @chunks, nil, "r", :query => {:_id => @file.files_id})
string = file.gets("5")
assert_equal 6, string.length
end