adds delegetion for eof? to AD::Http::UploadedFile
if you want to read the file you may need to ask if there is something to read from
This commit is contained in:
parent
e96d04a2e4
commit
96b72efc00
@ -17,7 +17,7 @@ def read(*args)
|
||||
end
|
||||
|
||||
# Delegate these methods to the tempfile.
|
||||
[:open, :path, :rewind, :size].each do |method|
|
||||
[:open, :path, :rewind, :size, :eof?].each do |method|
|
||||
class_eval "def #{method}; @tempfile.#{method}; end"
|
||||
end
|
||||
|
||||
|
@ -65,6 +65,12 @@ def test_delegate_respects_respond_to?
|
||||
end
|
||||
end
|
||||
|
||||
def test_delegate_eof_to_tempfile
|
||||
tf = Class.new { def eof?; true end; }
|
||||
uf = Http::UploadedFile.new(:tempfile => tf.new)
|
||||
assert uf.eof?
|
||||
end
|
||||
|
||||
def test_respond_to?
|
||||
tf = Class.new { def read; yield end }
|
||||
uf = Http::UploadedFile.new(:tempfile => tf.new)
|
||||
|
Loading…
Reference in New Issue
Block a user