Should work for readed ios

This commit is contained in:
Dmitry Borisov 2018-11-29 09:50:13 +03:00
parent 929b4b76c5
commit 11ca295071
2 changed files with 19 additions and 0 deletions

View File

@ -332,6 +332,7 @@ class FastImage
end
def fetch_using_read(readable)
readable.rewind if readable.respond_to?(:rewind)
# Pathnames respond to read, but always return the first
# chunk of the file unlike an IO (even though the
# docuementation for it refers to IO). Need to supply

View File

@ -178,6 +178,24 @@ class FastImageTest < Test::Unit::TestCase
end
end
def test_should_report_type_correctly_for_ios_that_have_been_read
GoodFixtures.each do |fn, info|
File.open(File.join(FixturePath, fn), "r") do |io|
io.read
assert_equal info[0], FastImage.type(io)
end
end
end
def test_should_report_size_correctly_for_ios_that_have_been_read
GoodFixtures.each do |fn, info|
File.open(File.join(FixturePath, fn), "r") do |io|
io.read
assert_equal info[1], FastImage.size(io)
end
end
end
def test_should_report_size_correctly_on_io_object_twice
GoodFixtures.each do |fn, info|
File.open(File.join(FixturePath, fn), "r") do |io|