add test for save_chunk fix

This commit is contained in:
John Bintz 2012-04-25 08:14:11 -04:00 committed by Tyler Brock
parent f93e05de83
commit 89d2130306
1 changed files with 29 additions and 0 deletions

View File

@ -122,6 +122,35 @@ class GridIOTest < Test::Unit::TestCase
end
end
context "Writing" do
setup do
@filename = 'test'
@length = 50000
@times = 10
end
should "correctly write multiple chunks from mutiple writes" do
file = GridIO.new(@files, @chunks, @filename, 'w')
@times.times do
file.write("1" * @length)
end
file.close
file = GridIO.new(@files, @chunks, @filename, 'r')
total_size = 0
while !file.eof?
total_size += file.read(@length).length
end
file.close
assert_equal total_size, @times * @length
end
end
context "Seeking" do
setup do
@filename = 'test'