Fix bug causing exception when fetching type when raise_on_failure is set

Mod tests to catch that code path
This commit is contained in:
sdsykes 2009-06-25 17:02:47 +03:00
parent 9e118a16b4
commit 1ff23ae490
2 changed files with 3 additions and 1 deletions

View File

@ -142,7 +142,7 @@ class FastImage
else
fetch_using_open_uri
end
raise SizeNotFound if options[:raise_on_failure] && !@type_only && !@size
raise SizeNotFound if options[:raise_on_failure] && @property == :size && !@size
rescue Timeout::Error, SocketError, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ECONNRESET, ImageFetchFailure
raise ImageFetchFailure if options[:raise_on_failure]
rescue Errno::ENOENT

View File

@ -35,12 +35,14 @@ class FasImageTest < Test::Unit::TestCase
def test_should_report_type_correctly
GoodFixtures.each do |fn, info|
assert_equal info[0], FastImage.type(TestUrl + fn)
assert_equal info[0], FastImage.type(TestUrl + fn, :raise_on_failure=>true)
end
end
def test_should_report_size_correctly
GoodFixtures.each do |fn, info|
assert_equal info[1], FastImage.size(TestUrl + fn)
assert_equal info[1], FastImage.size(TestUrl + fn, :raise_on_failure=>true)
end
end