File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ class << self
63
63
def read ( stream , ext = nil )
64
64
if stream . is_a? ( String )
65
65
stream = StringIO . new ( stream )
66
- elsif stream . is_a? ( File )
66
+ elsif stream . respond_to? :path
67
67
if File . respond_to? ( :binread )
68
68
stream = StringIO . new File . binread ( stream . path . to_s )
69
69
else
Original file line number Diff line number Diff line change @@ -14,6 +14,19 @@ def test_image_from_blob
14
14
end
15
15
end
16
16
17
+ def test_image_from_tempfile
18
+ tempfile = Tempfile . new ( 'magick' )
19
+
20
+ File . open ( SIMPLE_IMAGE_PATH , 'rb' ) do |f |
21
+ tempfile . write ( f . read )
22
+ tempfile . rewind
23
+ end
24
+
25
+ image = Image . read ( tempfile )
26
+ assert image . valid?
27
+ image . destroy!
28
+ end
29
+
17
30
def test_image_open
18
31
image = Image . open ( SIMPLE_IMAGE_PATH )
19
32
assert image . valid?
You can’t perform that action at this time.
0 commit comments