diff --git a/test/data/data.tar.gz b/test/data/data.tar.gz new file mode 100644 index 0000000..8f0f560 Binary files /dev/null and b/test/data/data.tar.gz differ diff --git a/test/data/sample_file.pdf b/test/data/sample_file.pdf index 4557c48..dbbecbb 100644 Binary files a/test/data/sample_file.pdf and b/test/data/sample_file.pdf differ diff --git a/test/grid_store_test.rb b/test/grid_store_test.rb index 150c29b..31810a0 100644 --- a/test/grid_store_test.rb +++ b/test/grid_store_test.rb @@ -133,6 +133,18 @@ class GridStoreTest < Test::Unit::TestCase #assert_equal ('x' * size) + ('y' * size) + ('z' * size), GridStore.read(@@db, 'biggie') end + def test_binary + file = File.open(File.join(File.dirname(__FILE__), 'data', 'data.tar.gz'), 'r') + GridStore.open(@@db, 'zip', 'w') do |f| + f.write(file.read) + end + + file.rewind + GridStore.open(@@db, 'zip', 'r') do |f| + assert_equal file.read.length, f.read.length + end + end + def test_puts_and_readlines GridStore.open(@@db, 'multiline', 'w') { |f| f.puts "line one"