minor: added grid store length accessor

This commit is contained in:
Kyle Banker 2009-12-11 10:02:38 -05:00
parent d268595584
commit 1cbb5d01ef
2 changed files with 7 additions and 0 deletions

View File

@ -54,6 +54,9 @@ module GridFS
# Default is DEFAULT_CONTENT_TYPE
attr_accessor :content_type
# Size of file in bytes
attr_reader :length
attr_accessor :metadata
attr_reader :files_id

View File

@ -71,6 +71,10 @@ class GridStoreTest < Test::Unit::TestCase
assert_equal "hello", GridStore.read(@@db, 'foobar', 5)
end
def test_access_length
assert_equal 13, GridStore.new(@@db, 'foobar').length
end
# Also tests seek
def test_read_with_offset
assert_equal "world", GridStore.read(@@db, 'foobar', 5, 7)