Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 96b72efc001473061e69bda0c601d8bda64027f3 1 parent e96d04a
@jigfox jigfox authored drogus committed
View
2  actionpack/lib/action_dispatch/http/upload.rb
@@ -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
View
6 actionpack/test/dispatch/uploaded_file_test.rb
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.