mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-08-10 00:01:04 -04:00
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:
parent
9e118a16b4
commit
1ff23ae490
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user